URL-appendix and dates


Just one small question that I have no idea how to start solving: When adding a new page in the panel and using a date as the page title, the default URL-appendix does not take the whole date (takes month+year but leaves out the day).

For example: If I add a page with title: 31.01.2018, it creates the URL /parentpage/01-2018. How can I make it automatically generate /parentpage/31-01-2018?

This is not possible, because with numbers like this Kirby treats the first part as the sorting number. When creating the URI, the dot is replaced with a dash.

A date like 20180131 would work, though. Or, you could manually change the UID when creating the page. Maybe a hook would work as well.

Oh ok I understand what it’s doing then. Ok no worries, I’ll find a workaround, thanks!!

If you really want a URL with those dashes, you could use a page slug without dashes and use a route that finds the correct page.

Well actually the URL structure is not that important. The thing is that I’m preparing this for a client, that often creates new pages (using dates as titles), and creates errors when adding a new page (in the same month) when one already exists:
20.02.2018 -> creates /02-2018
26.02.2018 -> error, the page UID exists

I just need to find the simplest solution so that the admin doesn’t see this error.

Is there a simple way to generate something like /02-2018-2 instead of the running into this error?

What you could try is use a panel.page.create hook that recreates the UID from the title (without the dashes) and then makes the page invisible again.

Ok, I will have a look into this. thanks again!