When an editor enters a new tag into Kirby panel, for example “Ééééé et Ààààà”, it should be possible to register somewhere that the slug of this tag should be “eeeee-et-aaaaa” while its displayed version will remain “Ééééé et Ààààà”.
What would be the simplest way to accomplish it ?
Why do you want to sluggify the tag? You can use str::slug($string)
to create such a slug, but maybe what you want is rather urlencode()
and urldecode()
?
Hi, Texnixe Sorry for a time lapse. And thanks. Retraced to str::slug($string)
in Toolkit API (will need to learn it). Seems perfect for a half of problem, as it will not remember the initial “Ééééé et Ààààà” to display it later.
Why do I want to sluggify tags ? I believe it’s safer then urlencode()
which doesn’t produce “eeeee-et-aaaaa”.
Tell if I’m worring about nothing.
The problem with str::slug()
is that you can’t recreate the original tag from the slug, which could be show stopper in case you have tags that differ only in one of the sluggified characters. Of course, when filtering by tag, you could compare against the sluggified version, but you might still end up with the wrong results (for example, in German, the words Ohr
and Öhr
are two different words, but their slug would be the same).
Therefore, using urlencode()
and it’s counterpart are the better options.
convincing example, texnixe. This would imply an ID as a 3rd parameter. Not worth the price, Topic closed.