GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Applies to Github pages and maybe elsewhere: In a jekyll blog if a post or page is edited frequently or otherwise, the blog post or page when opened fails to show current version due to browser caching, squid proxy server caching (in my case) etc.
Is this fixable? How can this issue be fixed, perhaps fixing options in the webserver, HTTP header etc?
You should look at the Html Cache-Control Header. My guess is that Squid or the webserver is responsible unless you defined in the html.
I know that Rails use a clever technique with the asset pipeline to overcome the problem by adding a md5 checksum to the file names when they are compile, so if a file change, the new file will be serve (new name).
Yes, as I mentioned my Internet access is through a squid proxy server which is responsible for this issue.
So, if I don't have access to the squid proxy server, is there still any way to fix this issue?
If possible, as @alexcp mentioned, add an md5 hash to the end of your files as a query string. If you set it in your config.yml, you should be able to use it everywhere.
Alternatively, modify the Cache-Control header.
Yeah, md5 hash will be a ugly hack but that should work. Thanks.
Hey anybody with a follow up on this? I am not sure how you can automate the appending of md5 hashes to posts.
If the files which are not updating are being called in in the html, you can create a Liquid Tag which, when called, will spit out a md5 hash or a timestamp of the current build and you can append the output to the <link href="url"> or whatever.
If you're looking for a specific cache expiry date:
<meta http-equiv="EXPIRES" content="Mon, 17 Sep 2012 12:00:00 GMT">
Or you can set the page to refuse to be cached:
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">