Pages with same title

We have an event page with one event per child page. These children are sorted by date:

num: '{{ page.start.toDate("Ymd") }}'

Now, there might be events of the same name but it’s not possible to create two pages of the same title in Kirby although the published pages will have different folders (given the date prefix). Is there a way to work a round this limitation (besided creating a nested structure separating pages with the same name)?

The prepended date in the folder name is ignored in the URL, and since you can’t have different pages with the same URL, it wouldn’t make sense, even if it worked. So no, you can’t have pages with the same slug (although you can have pages with the same title, but then you have to make sure that the slug is different).

Ah right, that might help. So, would it be possible to override the default slug using a page model? So I can have the same title value for different pages but with different slugs (e. g. combining date and title here).

I haven’t done that myself yet, but have a look at the custom add fields plugin: https://github.com/steirico/kirby-plugin-custom-add-fields.

Maybe you can also override the slug method in a model, don’t have time now to check out the source code.

All our events will be created from the frontend and I just noticed that Page::create() accepts the slug as a parameter. So we’ll most likely be able to set our custom slug there directly.

Yes, programmatically it’s no problem, you can add a timestamp or whatever to make the slug unique.

Yes, I’ve tested it successfully. The panel seems to be the problem. The plugin you linked describes how to change the slug in a hook (which makes sense) but also highlights that it’s not possible to redirect to the correct path afterwards.

So, I think in our case it’s not a problem because the frontend users will never see the panel and the panel users know how to deal with this issue manually.

Shall I post it as an idea though to allow for a custom slug method?

Yes, please do. I don’t know if there’s another solution or not.