A permalink is a permanent link to a piece of content on your site, whether it’s an article, a category, or an entity.
If you’ve ever been involved in a domain or CMS migration before, you’ll know this can be scary.
You may want a long-lived feature article to be accessible at catsupremacy.com/top-10-cats instead of catsupremacy.com/post/top-10-cats.
You may want to change this in the future, to catsupremacy.com/top-10-cat-breeds.
How permalinks work on Minima
We store permalinks in the database, with a path (/top-10-cats) pointing to a resource type (in this case, an article) and its ID.
If you change the permalink, a new permalink is created, and the existing permalink is set to redirect to the new one.
Example:
Your front end asks the API for the content which lives at /top-10-cats.
The API returns either:
- The resource, and the resource type
- The URL that should be redirected to
The advantages
- Old permalinks do not need to be inferred from old patterns
Default permalink patterns
- Articles -
/[slug] - Categories -
/category/[slug] - Pages -
/[slug]
You can change these defaults in your site settings.
Reading
In The Hidden Cost of URL Design, Ahmad Alfy explains the very real cost of getting this wrong - in user experience, and infrastructure cost.