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:
Blueprint:
title: Product
options:
changeSlug: false
create:
slug: blahblah
^^ this removes the slug option when creating new page and prevents user to manualy changing slug afterwards
Page Model:
<?php
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:
create:
slug: uuid
(or something similar).
Would this kind of feature make sense?