Auto-append to URL-Appendix

No, because this happens when the page is actually created, not in the create page dialog. The dialog is client side, the model is server-side code.

Maybe you also want to add a condition to only execute this if the slug is already taken?

And instead of always creating the slug from the content title, you might want to use the slug the user created, so

 if ( page( $props['slug'] ) ) {
   $props['slug'] = $props['slug'] . "-" . Str::random(3);
}
1 Like