medienbaecker / kirby-modules

Plugin for modular Kirby websites
MIT License
73 stars 7 forks source link

Auto-title function #43

Closed tan3ot closed 2 months ago

tan3ot commented 3 months ago

Some sections don’t have a title, so the editor has to come up with something to make them unique. A way to auto-generate the slugs instead of basing them on the titles would be great.

return [
  'medienbaecker.modules.autotitle' => true
];

The auto title could be maybe the timestamp? Or something like the uuid...

medienbaecker commented 3 months ago

I like the idea! Personally I always want to use meaningful titles/slug because that produces readable anchor links. But I can see how there can be modules where it's hard to come up with a title.

I'm a bit concerned about how the creation dialog and the module page itself will look like:

CleanShot 2024-06-05 at 18 31 46@2x

Putting something like the UUID or a timestamp in the big title doesn't look very nice.

tan3ot commented 3 months ago

Hm, that's true.

1. Creation dialogue If there are multiple module templates it just could look like this:

dialogue-without-title

But if it's only one possible module? Maybe just as text: "Template: Text with Images"

2. Ugly title Maybe just hide the title (and the last breadcrumb item)?

Untested:

[data-template^="module."] .k-header-title,
[data-template^="module."] .k-breadcrumb ol li:last-child {
  display: none;
}

And: even if this works, this should be configurable for each modules section. (Perhaps possible: issues after changing this behaviour later on?)

medienbaecker commented 2 months ago

Unfortunately this does not seem to be feasible.