I’m storing my blog posts in numerical sequential order, like primary keys in a RDMS.
My permalink format is going to be as so: example.com/post/1/title-of-story-1
I want the last portion to not matter though. In the event that I change the titles to any of my blog posts, I still want my old permalinks to work.
I want example.com/post/1/anything-here to route to example.com/post/1
What is the best approach to achieve this? I’m not very familiar with regex and nginx rewrite rules, I’m guessing that’s the way to go about it.
Thanks in advance.
You should be able to do this in Grav with the site.yaml file using a wildcard alias for the routes. See http://learn.getgrav.org/advanced/route-aliases
This is sort of in the realm of custom routing, which at the moment Grav does not support, but could be pretty cool to have in the future.
Thanks for the replies.
It would be great if that could be added. It’s useful in situations where a post title may change or the same title is used often. If routing supported more than 1 wildcard it could be as simple as something like this perhaps?
would route to
Please create an issue here: https://github.com/getgrav/grav/issues
I’ll mark it as a feature enhancement so it’s not forgotten!