When you begin a new Jekyll site with the only intention of writing, you usually begin with the default theme and configuration. With those, the permanent links (permalinks) of the posts have the following structure:


This creates a post URL with the following structure:


As many of my posts belong in more than one category, I don’t really link those permalinks. The URL often gets too long, and once I publish my post I can’t re-categorise my posts without breaking any incoming links.

The solution for this has two parts.

First of all, I included the following configuration line in _config.yml, to change the default permalink structure:

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

This way, the categories are no longer present in the permalinks, and we would have the permalink line the one this post (/2023/10/10/testing-new-permalinks). This fixes all future posts, preventing the categories from appearing in the URL. And, in case you wonder, the categories still work as normal: you can see see this post correctly filed under all its categories in https://gvisoc.com/categories.

Second, I needed to lock all previous permalinks into their current previous form in order to prevent breaking the (very few?) existing incoming links. For this, each post can include its own specific permalink in the YAML preamble, so I spent a bit of my time this morning copying and pasting the current permalinks in each post.

For example, this:

layout: post
title: This Site Has Zero Cookies
date: 2021-05-12 9:00
- privacy
- this site
hidden: true
permalink: /privacy/this site/2021/05/12/No-Cookies.html
excerpt_separator: <!--more-->

is the preamble of the post “This Site Has Zero Cookies”.

Hopefully it all went well!


Comment on this post on Mastodon, or write to the email at the bottom of the page