1

I'm learning a jekyll with github pages. When i create a new post (whatever how - locally and commit to github or online via github page) i need to force reload (ctrl+r) my page to see changes. Is it normal?

my repository url is here

2 Answers2

1

As Github pages content has http response headers like Cache-Control:max-age=600 and Expires:Wed, 10 Jun 2015 16:30:25 GMT (a date ten minutes latter), the only way to avoid page caching is to setup your browser not to cache.

If your read carefully this answer about http-equiv meta (read HTML meta tags vs HTTP response headers paragraph), you will understand that, in your case, http-equiv meta are useless.

And this cache has nothing to do with Jekyll but with github pages servers setup. A 10 minutes cache on a personal blog is not that big. A regular user will not need a refresh every 30 seconds.

And as a developer you are not supposed to develop on you production server, but on a development one, where you can specifically setup your server.

David Jacquel
  • 51,670
  • 6
  • 121
  • 147
  • i have added these meta lines to my head.html but it not works. What is the point of using jekyll for blogging as a user must reload page? – user3107190 Jun 10 '15 at 21:52
0

That's just browsers doing their thing. If you use the published: false Front Matter to work on drafts then you can conditionally disable caching using the following snippet in the <head> section of your post layout:

<% if page.published != true %>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<% endif %>

At the top of your work-in-progress:

---
layout: post
title: My New Article
published: false
---

When you want to publish for real, just remove the published: false YAML or set it to true.

Erik Gillespie
  • 3,929
  • 2
  • 31
  • 48