Designing a URL Scheme
In the past I have found broken links in books, in web pages, and even in my personal notes (I saved a link I found useful, and it broke the next week). I don’t want to be that human… The one that changes the links after creating them.
But how do I achieve that? Since I created this site, I’ve changed the urls multiple times because I thought of a better name for the category, or changed a title, or other reasons. My excuse untill now has been “the web page is almost empty, so for now I can play with these links” - but if I didn’t have a clear strategy it looked like I could keep changing the url scheme for ever.
After some googling I found a great article by Tim Berners-Lee, Cool URIs don’t change. Based on this read, I chose to follow these simple principles:
- Short URLs (slug instead of big title)
- No content that can change in the URLs (no category - date is ok)
Based on the principles listed above, I updated my permalink
variable as follows:
# _config.yml
permalink: /:year/:month/:slug
The slug will be a short keyword that represents the main topic being discussed. I will try to choose keywords that are generic enough so I can freely change the title of the article, and also intuitive enough so by reading them I can have an idea of the topic discussed.
The articles still do have categories and tags in the front matter, but that information is not used for building the URL. I can still use the category pages configuration I prepared previously. The only difference with how it worked before is that now, you can’t tell what category a post belongs to by simply reading its URL.