Slug format/rules configuration?

I am trying Kirby CMS right now (v. 4 alpha) and really like its simplicity. I am thinking about migrating one of my projects to Kirby.

And I faced slug generation issue: the project has slugs in different languages, and I do not transliterate URLs to English. For example, “Greetings” will be “Grüße”. So, I’d want ask authors if I can disable latinisation for slugs and uploaded files, and also disable forcing of lower-case. The only character I want to replace is space — with underscore.

Is it planned to implement in v. 4? Is it easy to “patch” for existing version?

Slugs will usually be sluggified (umlauts/special chars, spaces, all lowercase), you can, however, configure how Kirby treats slugs; might be a bit tedious though to define them letter by letter for multiple languages.

It’s a nice idea. Thank you, Sonja. I tried it via language-specific settings as described here: Language specific slug rules | Kirby CMS. What I get:

‘slugs’ => [
‘Ü’ => ‘ABC’,
‘ü’ => ‘def’
]
— both symbols are converting to ‘def’. It seems, Kirby converts all to lowercase before applying this table. But I wanted to have uppercase symbols in slugs too.

‘slugs’ => [
‘ü’ => ‘ü’,
‘ẞ’ => ‘ẞ’
]
— this table does not apply at all, I get latinization.

‘slugs’ => [
’ ’ => ‘_’
]
— also does not apply, still ‘-’ symbol.

That could well be…

Will it be good if I create an issue on GitHub? Because I am not familiar with Kirby code yet to patch it myself.

That would rather be a feature request for https://feedback.getkirby.com

Thank you, I have created a feature request: UTF-8 slugs support · Kirby Feedback

I don’t think there is an easy way to solve this, the slugs are always created with the underlying Str::slug() method which first converts to lowercase. And this is used all over the place, like the Page::create() method etc.

I looked at the CMS code, I see some places with Str::slug like ‘safeName’ function, ‘changeSlug’, ‘create’, and so on. Also, maybe it’s necessary to correctly parse URL encodings (all these clumsy percentages) in URLs passed to PHP (the browser address bar shows it as normal non-latin characters). Overall, not super-easy one-liner patch but should not be hard. That’s more ideological problem, if the author want to support it or not.

I am thinking about special slug type ‘utf’, the CMS code will check it and then will not do any transliteration and converting case. And delimiter could be changed via the ‘slugs’ array in config.