How do you go about migrating your existing blog entries from one URL scheme/pattern to another without breaking existing links scattered outside of your blog?

When I first setup this blog I didn’t pay too much attention to SEO or how the automatically generated URLs were turning out. Hindsight is 20/20, and that was a big mistake. As it turns out, the way I had been organizing my posts as /<category>/ would mean they would get generated as /:category/YYYY/MM/DD/SLUG. Which wouldn’t have been so bad if my slugs hand’t always been an entry count for that date, meaning that they would always be 🙃

I know, I know, the hubris of thinking I’d be writing more than one post per day, when I haven’t even manage one per year is enormous.

Anyway, I wanted to change this, and thankfully there’s a pretty nifty jekyll-redirect-from plugin to help you create the redirect pages in order to preserve an existing URL, but having it now point at something else (or vice-versa).

So now, if I did everything right, older URLs for this blog will now redirect to the updated slug-based variants. E.g. /swift/2021/07/23/01 will redirect you to /detecting-memory-leaks-via-tests-part-2.

# Sources