Template select options always on? How to do?

In all cases, we always want the ability to change the template. Is there a way to turn this feature to always on. I’ve put it in the every blueprint, sometimes it shows and sometimes it doesn’t. We just want the user to always be able to change the template.

Have you set the template for certain pages somewhere in your blueprints like this to a single template:

  template: project

Let’s say that was your setting in the projects template, then allowing to switch templates in the child page (i.e. project) is not possible.

Or even

pages: default

Yeah, that is the same setting, though. The whole point is that limiting templates to a single one and allowing to switch templates is mutually exclusive.

Here is an example from my script.

pages: default
title: link
    label: Title
    type:  text
    label: ext. URL (dominant)
    type:  url

<img src="//cdck-file-uploads-europe1.s3.dualstack.eu-west-1.amazonaws.com/standard20/uploads/getkirby/original/2X/a/ada290be6070d2ca2676f21e08a54282805277a5.png" width="690" height="147">

I tried both in my .yml file blueprint. Some instances template is showing and in others it wont.

But that is exactly what you should not do, if you set pages to “default”, only the default template can be used by the subpages and your users wont be able to change the template afterwards.

Just set pages to “true” or “false” in all your templates, depending on whether or not these pages may have subpages or not.

Another example where I used both

title: submenupage
pages: true
template: true
pages: default
    label: Title
    type:  text
    label: Text
    type:  wysiwyg


Still nothing.

Again, there is a : pages: default:wink: Just throw that line out. This setting limit the allowed templates to the default template.

Removed but still doesn’t show. It will in certain cases. But in others set to this template it wont.

Well, the setting applies to subpages of pages with that template, not to the page with that template itself. So for a page with that template you would have to check the parent template.

Yeah, it looks as though it helps if

  1. Pages are recognized either, true or false,

  2. options: is placed in front of the template: true

  3. Making sure that this is setup on the parent item. This includes sites.yml, projects, and default.

I’m trying to explain it again:

A given page can only have a template that is allowed by its parent page. If the parent page allows only one template (be it default, mytemplate or anything else), switching will of course not work (there is nothing to switch to).
This means that you don’t necessarily need to set the setting to true, but you can also do it like that, just make sure that you allow more than one template:

  - default
  - project

That’s it for the parent template. Next step is the subpage template. The template blueprint option can be set to true or false. It just enables/disables the toggle.

TL;DR: You need to have:

  1. more than one allowed template in the parent blueprint
  2. the template blueprint option of the subpage template set to true or not set at all (which defaults to true)
1 Like