Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll Bootstrap based blog - Expire headers?

I have a Jekyll bootstrap based blog hosted on Github pages.

My problem is: Every time I change something on my web page, I have to forcefully reload the page (CTRL + R) to see the changes.

Jekyll or my browser does not seem to realize that there is a newer version available to send out.

How can I configure Jekyll to better handle this?

like image 203
Sebastian Hoitz Avatar asked Mar 09 '12 17:03

Sebastian Hoitz


2 Answers

There are a couple of jekyl plugins to handle assets cache busting.

https://github.com/ixti/jekyll-assets/

http://matthodan.com/2012/11/22/jekyll-asset-pipeline.html

I tried jekyll-assets and it's pretty nice as it manage all kind of assets with an md5 version number.

Before I use to append a string to my css links at compilation time.

<link href="{{ ASSET_PATH }}/css/global.css?{{ site.time | date:'%Y%m%d%U%H%N%S' }}" rel="stylesheet">
like image 191
Yannick Schall Avatar answered Oct 22 '22 12:10

Yannick Schall


You can add these meta tags to your html to disable browser caching for your pages.

<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
like image 30
Murat Çorlu Avatar answered Oct 22 '22 11:10

Murat Çorlu