Well, this does not answer my question. I already new the option “maxlength”, as I mentioned in my question. Problem is, how can I make a slug longer than 128, not shorter.
It does not say that you can only shorten the slug.
By entering a value above 120, you can increase the slug length.
I have just tested it and it works perfectly.
Here is an example with 258 characters:
Okay, did absolutely not work for me, I tried several things. Must then be another problem with my configuration, not a general thing with the maxlength-option.
Good to now - thanks a lot.
I was able to reproduce the behaviour: I have just installed a fresh starterkit with Kirby 3.9. Although I have extended the length of the slugs to 258 characters in config.php, it is shortened to 128 characters. There is also no warning that the slug is too long. In Kirby 4 it works as expected. Perhaps it is a (not yet discovered) error? Therefore, I hope for feedback from @texnixe , if there is another setting for Kirby 3.9.
I finally upgraded to Kirby 4, but the problem still remains.
I then downloaded a fresh starter kit with Kirby 4.
1.) Added
‘slugs.maxlength’ => 258
to config.
2.) created one article.
3.) Changed the slug to a string around 256 chars, it’s immediately cropped to 128 chars
No difference.
But isn’t the unit-test expecting some exception because 273 is too long?
I also thought that it might be some maxlength-problem on my local system (macos), but the max filename length is 255 and I can create a dir with a few chars shorter
slugs.maxlength only works for setting a shorter slug length than 128, so basically, this is used for validating the slug length. However, when it comes to creating a new page in the Page::create() method, it goes through Str::slug(). This method has a $maxlength parameter, which defaults to 128, when the parameter is not set (and it is not at page creation).
Do you think we should pass the value of slugs. maxlength there (and potentially other places, would need to search through code for other places)? Or is the current behavior correct and we should just mention this in the docs?
If there is no good reason to keep the max length, then we should pass the parameter along where we use Str::slug() in the page slug context (create, duplicate, changeSlug() etc).