Site URL's with date

Hello,

I want to name the site url automatically with date. I got two fields “Title” and “Date”. The url should look like “…/2016-09-15-LoremIpsum” to avoid doubles with the same name. If you can guess its like a blog post. Is there something in the docs or a tutorial where i can get some advice how to make it right?

Thanks

Check out the docs on routing, I’m not so sure what you are after can be easily achieved, but Wordpress URLs is at least similar … You can create a custom page method to generate the URLs. You still won’t be able to have two pages with the same UID.

1 Like

Thanks for the Links. In the base kirby structure the title is automatically the url. Like a new post with the title “Lorem” got the Url “…/Lorem”. There is might be the chance of a post happening a year later that can have the same name so I want to prevent that with integrating the date into the url. Keep the title “Lorem” and the url “…/16-09-15-Lorem”

Think the Wordpress think is when I want to convert those into the easier Kirby structure. The methods seemed to be the right way just have to read some stuff there.

That won’t work with just a route. There can still only be one page with that UID (“Lorem”). Adding a date in the URL won’t really help with that.

What you could do however is to make actual subfolders for each year and month. This will allow you to have the same UID in different months.

1 Like

Just changing the URL with a route won’t help, though. You would still end up with two pages with the same UID which is just not possible.

An option would be to use a tree structure with year folders or something similar. However, if you could have the same UID in the same year, that won’t be a solution, either.

Edit: Lukas was faster, and yes, if you use additional subfolders for months, then it becomes less likely that you end up with the same UID.

Hmmm okay … Is there maybe an easier solution, that could be automated?

The problem is that you can’t have numbers in UIDs because of the way Kirby works with numbers being used as visibility flags …

1 Like

Thank you for your help. The client then has to write unique names as possible. Should write a little booklet for that :v:t3: