Show blueprint section based on (intended) page template

Hi, I`m trying to show a blueprint section based on the intended page template.

I tried with an additional info field where I display the template-name:

# fields/intended_template.yml
  label: Intended Template
  type: info
  text: "{{ page.intendedTemplate }}" #team_member
# sections/contact_details.yml
type: fields
headline: Contact Details
  intended_template: team_member

but this does not work.

Is there another way to evaluate the sections conditional?
Something like:

 "{{ page.intendedTemplate == 'team_member'}}"

or can I create a custom page method which returns a boolean:

  "{{ page.isIntendedTemplate('team_meber')}}"

Can someone point me in the right direction to solve this?


You can only work with conditions from another field’s value. Since the info field doesn’t store anything in the content file, I think this doesn’t work.

So I need to build a custom (hidden) field which stores the intended template?

Yes, a hidden field, but you don’t have to build it, you can create a hidden field in your blueprint and then update this field with a hook on page creation.

@pixelijn: Thanks!

This will change the intended_template field according to my needs:


return [
   'hooks' => [
        'page.create:after' => function ($page) {
            $page->update(['intended_template' => $page->intendedTemplate()]);
        'page.changeTemplate:after' => function ($newPage, $oldPage) {
            $newPage->update(['intended_template' => $newPage->intendedTemplate()]);