I'm using Jekyll for my blog. I've added a new blog post here, where mistyped the URL name to be /2019/09/22/automation-patents-paper/
(so it's the wrong year).
This screws up the date at the top of the post and if I leave the date of the post at 2019 then it'll stay at the top of my list of posts for two years ...
But I've already shared the blog under this URL on social media and would like people to continue be able to get to the post through that link. I've send the link to some people by email that I would really like to click on it and not get to some 404 page.
If I republish the post with the correct name, is there some way to reroute the old URL to the new URL?
Use a plugin to redirect the old post url to the new one, and fix the post with the correct url.
Using jekyll-redirect-from add to Gemfile:
gem 'jekyll-redirect-from'
Run bundle
or gem install jekyll-redirect-from
, and then add it to _config.yml
:
gems:
- jekyll-redirect-from
Now in the new post add the old url:
redirect_from:
- /2019/09/22/automation-patents-paper/
that will generate: /2019/09/22/automation-patents-paper/index.html
pointing to the new post.