Leverage browser caching

Google PageSpeed recommends that I “leverage browser caching” for my CSS by “setting a maximum age in the HTTP headers.” How does one do this with Jekyll?

The good news is there are a bunch of options and resources available to you since what you want to do isn’t specific to Jekyll.

Depending on the server type you’re using to host your site this will vary, but if you’re using Apache you can set caching headers via a .htaccess file.

HTML5 Boilerplate has a really good one that is heavily commented that walks through all kinds of good things you’ll want to enable for improved performance (gzip compression, etc.) and security.

1 Like

Thanks! Now I’m trying to figure out how to do this without .htaccess since I’m using nginx.

They also have server configs for nginx

@mmistakes Thanks! I also found this:

Hi - I’m trying to resolve the same issue you were working on - did you ever figure it out? I see this github that you posted - is it just a matter of copying these files over to the root directory of my jekyll blog? Thank you in advance!

Do I just paste these files in the root of my jekyll blog?