By default you can’t change the blueprint/template of pages. Only after you add the changeTemplate option.
That’s how the page settings dropdown looks in a fresh Kirby panel:
In Kirby 2 it was the other way around: if you wanted to restrict it, you had to list available templates.
I know Kirby 3 is a completely different story, with the pages sections etc. — but I find the process super exhausting:
There’s no changeTemplate: true option. So you have to define a list of every template in every blueprint.
A blueprint name changes? A new blueprint is added? You’ll have to open every single other blueprint and edit the list.
Defining the available templates in the blueprint of the current page may not always be the best idea. For example when the blueprint should have different changeTemplate options in a different parent.
Maybe I’m missing something and I’m trying too hard to use my Kirby 2 workflow. Is there any other, more efficient alternative?
I didn’t know that, either. I just thought it could probably work and tested it.
I actually quite like it like this, because usually a template change only makes sense in very limited circumstances. But that is just my personal opinion and your use cases might be different.
Maybe we can get some more feedback from other users and if it turns out it is not ideal for many, then open an issue in the ideas repo.
I found this while researching the changing template workflow.
I think part of the reason why the general workflow currently does not allow for changing of templates by default is due to the features warning:
When an editor switches templates, all fields with the same name and type will be synced. Incompatible fields will be discarded. Be aware of this step when you define the list of compatible templates.
I wonder if it might be better in a case where template switches happen, incompatible fields are preserved in the content file.
Say you have two templates for photo galleries and one includes fields that allow you to configure some aspect of its template. Wouldn’t it be better if you could switch between the two templates while designing the content and see which template fits best without worry of losing fields or needing to make sure the other templates have potentially irrelevant fields just to preserve small bits of data.
But now that I write that out… aren’t the fields preserved in the blueprint and not the template?
The problem is that even with identical field names, the format the fields are stored it might be incompatible (think of a field that stores information in yaml format vs. a field that stores information in a comma separated list).
If you want to preserve fields, you could make these fields hidden in the second blueprint, so that data is preserved, I guess.
Since we have conditional fields now, maybe some use cases that required a change of blueprint might be covered with this new feature and we’ll certainly see improved conditional fields/section in the future.
Hm, I don’t know if this can be solved with a plugin. The create option maybe with a custom pages section, but for the blueprint options, I wouldn’t know how.
It seems to work great (and I’m quite a bit proud of it).
There’s only one issue: you can’t extend in an extend. That means it’s not possible to outsource the modules pages section and extend the modulehelper.
@thguenther Thanks for pointing me to this solution! For some reason I wasn’t able to get any blueprints back from kirby()->blueprints() I’m not sure why. But it did work for me create set my list via a config option(), so I’m able to set the list manually until I figure why I couldn’t create the list from kirby()->blueprints().