blogphotosbookshire me

Trailing Slashes, Github Pages, Jekyll 3 & 404s

14 March 2016

A month ago Github announced that they was now running Jekyll 3. At this point I already tried to upgrade but ran into so many issues I gave up, so I was still building my site with Jekyll 2.

Looking at the announcement I figured that it was no big deal since every major deprecations would only occur in May. It really felt safe to stay with Jekyll 2 and migrate in a month or two.

Big mistake.

The Symptoms

A few weeks later, while checking my analytics, I noticed that my view count was dropping slowly but surely:

Google analytics drop

I thought that there was some algorithm change on Google’s side and didn’t bother digging more into it… until I later checked Google Webmaster tools and saw a large increase in crawling errors around the same time!

Google webmaster tools drop

Note that this only occurred mid February and not right when Github started using Jekyll 3 because this was the moment when I published a new article. This lead me to rebuild my site, bust my cache and so on. This made the whole experience even more confusing.

The Issue & How To Solve It

Since this site is not my main focus, I could only investigate later on. Once I found some time to spend on it, I understood that this was due to a major change in Jekyll 3 regarding trailing slashes as explained in the migration guide.

In Jekyll 2, any URL constructed from the permalink: field had a trailing slash (/) added to it automatically. Jekyll 3 no longer adds a trailing slash automatically to permalink: URLs. This can potentially result in old links to pages returning a 404 error.

My configuration at the time looked like this, with no trailing slash explicitly mentioned:

permalink: /:categories/:year/:month/:day/:title

A lot of external links pointing to my blog had trailing slashes but I never paid any attention to this since it was working properly. Once this trailing slash redirect logic stopped working on Github Pages, I lost a lot of links, dropped terribly in SEO and lost most of my traffic in the course of a few weeks.

Ouch.

I fixed the issue by adding explicitly the trailing slash to the permalink configuration. Once it was done I started to see my stats slowly going back up again.

permalink: /:categories/:year/:month/:day/:title/

It’s a bit of a shame that such a breaking change was released somewhat under the radar. I’m wondering how many websites are now returning 404s because of it… The positive side of this is that the Jekyll team did take this into account and updated their documentation.

The only sure thing is that from now on I’ll try to pay more attention to my blog’s analytics!

Read the comments or contribute with your own