I just launched this new blog and immediatly made a huge mistake: I typo’ed the date for the first post … and every subsiquent date thereafter.
This created an interesting problem … I had already shared the link to those posts and Google had already indexed it. With a statically built site, how can I move the posts, but redirect the old url to the new location?
I added this to my
_includes/head.html file (just above the
Then, created this new
Now, I can create new pages (I can’t create posts, because they will be listed in the index page .. so, posts win here) that look similar to this:
The end result is a surprisingly flexible way to redirect users (and inform search engines) to relocated content.
Update: It was pointed out to me (by @iamcarrico on the Jekyll IRC Channel) that there is a plugin created by the Jekyll team that handles redirects that’s far simplier and easier to use. However, I’m going to continue using my thing, only because I show a pretty screen if the redirect doesn’t happen.