You are not allowed to change the URL appendix


The latest Kirby 3.5.6 has an issue with page URL appendixes:


The issue emerges in the following circumstances:

  • The current page URL appendix contains underscores
  • The user has no permission to change page URL appendix
  • The user attempts to change the title of the page

In this scenario, Kirby has auto-filled the URL prefix field with underscores replaced with dashes (e.g. “sign_out” → “sign-out”). Clicking “Change” after changing the title results in the error message above, even though the user did not attempt to change the URL prefix.

Fortunately, the panel will commit the change in the title field, and user can work around this issue by clicking Change, then Cancel and then refreshing the page. But this is a bit sub-optimal solution.

I guess that is a page that was created outside the Panel, because the Panel doesn’t allow creating Pages with underscores. That’s probably the issues here, because Kirby tries to automatically change the URL appendix to something valid and fails.

Since you mentioned 3.5.6, did this not happen before?

I’m not sure if Kirby has or hasn’t ever allowed underscores in page slugs. The site was made with Kirby 2 and then upgraded to Kirby 3, and I have no recollection whether all the pages with underscores were created manually or via the panel.

The problem didn’t exist before Kirby 3.5.0, which introduced a unified title & slug edit dialog:

One option is to replace all the underscores on my site, but it’s something I’d rather avoid since it means breaking a lot of URLs.

Maybe create an issue on GitHub. I don’t think there is a way to allow underscores in slug, so if a user was allowed to change slugs, you would definitely end up with changed slugs.

I guess you changed the slug manually, not from Panel UI.
Because you can’t set slug that contains underscores from Panel.

I don’t think this is a bug because the underscore is number separator for folders: 1_home, 2_about, 3_contact

In Kirby 2, are you sure?

Also, the number separator used to be a dash until Kirby 3.

That is right, and I think the problem only exists now because underscores are not allowed in page slugs in Kirby 3 and now with the combined dialog, Kirby automatically tries to change the slug which is, however, not allowed for that particular user. So trying to enforce a proper slug fails.

If the same was done by an admin, the slug would automatically be changed without an error message.

So to be on the safe side, you would probably better change the slugs and add some rewrite rules from the old to the new URLs.

The permission to change the slug has been disabled in page blueprints for the pages in question, so the dialog fails for admin users as well.

Yeah, it starts to seem like changing the slugs is the only option. The site has been in development since 2018, and underscores in slugs have worked pretty well so far. Too bad the migration docs didn’t mention that this would become a regression issue later on.

Another option would be to overwrite the dialog itself, removing the changeSlug part… Although I think that the slug input should be ignored when changing slug is disabled.