URLs for blog posts
What are the common URL?
Let’s imagine you have a blog. You are posting on this saturday 17th mai 2024 “State of the HTML 2024”.
How the URL can be?
Note: I use the url path in the examples to make it short. So a URL https://blog.lyokolux.space/posts/2024-05-17-url-for-blog-posts
will be shown as /posts/2024-05-17-url-for-blog-posts
. The title of the blog is slugified in the URL.
The simplest url path is a counter or an id: /342
. This id isn’t human readable. We want that though. /state-of-the-html-2024
can be the simpliest candidate.
Sometimes you can encounter a shorten version of the title: /state-html-2024
. The determoiners or short, unimportant words are removed.
Some people have other thing than blog posts, so they prefix them with /posts
. Our state of HTML 2024 post would be reachable at /posts/state-of-the-html-2024
.
Blogs often have categories or tags to group posts together. I wrote about categories and tags for blog to explain them from my point of view. They can also be found in the url: “
The publication date is also often mentioned. It can have a lot of format. They often follow the ISO 8601 order: Year, month, day. Some variations include only the year, some until the day.
/2024/state-of-the-html-2024
/2024/05/state-of-the-html-2024
/2024/05/17/state-of-the-html-2024
I never saw hours or minutes in the URL.
Others put the date directly in the slug of the blog post: 2024-05-17-state-of-the-html-2024
.
What to choose?
Well whatever you find attractive. I don’t know how this is relevant for SEO. I simply want myself to avoid URL clashes: having two blog posts with the same URL is wrong.
Another rule is Keep it simple, stupid! (KISS).
There are currently 0% chances I will write two posts with the same title on the same day. That’s why I came up with /yyy-mm-dd-blog-post-slug
. I put the date before the post slug.
I was not sure all the content is related to posts, so I prefixed it with /posts
. Indeed I was right, because I added other navigation pages for categories and tags: /category/numerique/
or /tags/WeblogPoMo/
.
That’s it, KISS /posts/2024-05-17-url-for-blog-posts
It works, fine and is human readable. Good.