Feature: UUID as a Slug option

Sometimes I don’t want to bother generating slugs when creating/updating Pages. Idea is that the Slug would be the same value as Page UUID. My current solution:


title: Product

  changeSlug: false

  slug: blahblah

^^ this removes the slug option when creating new page and prevents user to manualy changing slug afterwards

Page Model:


use Kirby\Uuid\Uuid;

class ProductPage extends Page

    public static function create(array $props): Page
        $uuid = Uuid::generate();

        return parent::create(array_replace_recursive($props, [
            'slug'    => $uuid,
            'content' => [
                'uuid' => $uuid,

This does the trick however is too much work and too much repeating and unnecessarily clutters the code when you want this feature for more types of pages. Wouldn’t it be nice to have this feature built in?

For example:

  slug: uuid

(or something similar).

Would this kind of feature make sense?

This is already possible, just with a different syntax:

  slug: "{{page.uuid.id}}"

Yes, that was my first idea as well. However this creates different uuid values for slug and page uuid (stored within the content). Which is quite an odd behaviour, in my opinion.

You are right, I guess that happens because the uuid is not known at this point so a new one is generated at that point.

Yes. That is correct. This is not a feature I couldn’t live without but just an idea. Perhaps, nice to have.

What you could do is create a default page model with your create method, so if a page doesn’t need its own model, you save a lot of model creation. Other models can then simply extend this default model.

You are absolutelly right. There are even more ways to go about it. Sometimes I forget that Kirby is still just PHP. :man_shrugging:

Thank you!