Panel date url keys

Ive seen discussions around this but i ask again.

When using


The folders get names like “20170216-fancy-event” although url key is still made from the title. I get this is very deliberate so that folders get sorted by date.

If i wanted url-keys to be the same as foldernames the best way is to use page update hook and rewrite url key eachtime?

Thank you

I’m not sure I get it. What do you want to update, the field called URL-Key? You can only use this field in a multi-language installation and only for the non-default languages.

Oh so this is more complicated than i thought. I had no idea you can use url keys only on translated content.

I want to have url

I guess its whats called wordpress urls in docs. Funny thing is the folders have right name but kirby is clever removing date. So i have to actualy change the title to 20170713 Funny Event to make url on default language lol.

Its first time kirby seems strange. So the hack to do this would be to use urlkeys so make separate language which i dont use :D.

Or use title as “url” field and then make differend field to be title…

Problem is you can’t use titles that start with a number in Kirby because of the way visibility works. A title like “20170213 Fancy event” will be converted to a folder name “20170213-fancy-event”, where the number will not appear in the URL because it will be regarded as sorting number.

Check out routing to simulate Wordpress URLs:

I know about the wordpress url docs but then i get to the same issue of duplicate event names. I simply cant use routing for that. I tried.

I will have to figure out differend solution.
Anways thank you!

If somebody was looking for this - i ended up with dates appended instead of prepended. This way i get original urls without anything ugly.

Its quite simple realy for my usecase

kirby()->hook('', function($page) {
  if($page->template() == 'event') {
    try {
      $uid = $page->title() . '-' . date('j-m-y',$page->date());
    } catch(Exception $e) {
      echo $e->getMessage();

The move() function is basicaly rename of the folder, everytime page is saved the foldername is regenerated from the title.

It throws error when you try to set event of the same name to the same date, but you cant avoid that and chance of doing this is minimal.

The problem I see with this approach is that the URL of the event changes with each page update. Is that intended use? So if you post a link to this page, the link will be gone the next time the page is updated.

Sorry, why would it?

The url changes if the date of the event changes. But this rarely happens.

Yes its wasteful i should probably just check if the date is already appended so it happends only on the first save. Good point.

Oh, I’m very sorry, forget about it. I totally overlooked that you are using the date in the page, my bad, I thought you were appending the current date :blush: