Limit maximum chars possible for page url

i recently encountered a problem, that my client entered a very long title for a page. the resulting slug was equally long. this caused mailjet to not accept the url (longer than 100chars).

i know i can limit the maxLength of the title field but that does not solve nested pages. i would like to know if there is any way to validate the slug. registering a hook seems possible, strlen($page->url()) and changing the slug if needed. but i would like to make this more visible for the user.

is it possible to display any other message instead of the :) after saving? not with just a hook, right?

Maybe use tinyurl or something like that to circumvent the problem?

yes. tinyurl() for the mailjet newsletter object is my current solution. but i wanted to keep all base links the same, like not mixing tinyurls and regular urls. since almost all browsers support about 2000 chars i find mailjets limit unreasonable.

i will try to think of another solution and report back.

Yes, a 100 character limit is a bit ridiculous. But the problem is, where do you want to start shortening the urls? Probably depends on your nesting structure, if it is not very deep, you can limit yourself to tuning the last path.

But with a hook, you cannot change the message in the panel.