Page blueprint and page template not applied

Hello everyone,

I have an issue with assigning a page template and assigning a page blueprint. To reproduce this problem in a clean context I used the most recent Kirby Starterkit-main. I changed nothing except these steps:

-I created a page template: contact.php in the templates folder; screenshot:

-I created a page blueprint in the blueprints/pages folder: contact.yml - screenshot:

-I added a page named ‘contact’ via the panel.

When I open the contact page, page template is not assigned, I added an h1 tag with ‘Default’ written in it and this pops up; so the default template is used.

Also the page blueprint is not assigned in the panel. This is also uses the default.yml blueprint instead of the contact.yml which I created.

What am I missing here? I thought the idea of Kirby is that the page blueprint and page template are automatically assigned by having the same (lowercase) name? Is there some setting I should adjust?

Thanks in advance for some advice!

I think you missed content folder. You should have to /content/contact/contact.txt file. Do you have?

  • /site/templates/contact.php for the page templating
  • /site/blueprints/pages/contact.yml for the panel form
  • /content/contact/contact.txt for the page content but also detecting page type

Thanks! I added the page via the panel, and from there it got assigned a ‘default.txt’. So it seems it went wrong there! When I change the the file name to contact.txt it worked.

Great! Probably you selected default page template from create page dialog. You have to select contact page template to create contact.txt in content folder while creating page from panel.

If you can’t select your contact template from the panel create page dialog, you probably have a limit in your site.yml preventing you from selecting it. Add your template name to the site.yml in this case. Example in the starterkit, you would add contact after default:

      # The `pages` pages section shows other main pages of the site
      # Using the `templates` option, we limit which types of pages are shown
      # Using the `create` option, we limit the type of page that can be created when a new page is created
      # Note that the `sandbox` page and the `error` page that also exist in the content folder but use different blueprints thus do not show up in the list
      # Since the error page's blueprint is set to `read: false`, it wouldn't show up here even if you added the error blueprint to the templates list
      pages:
        type: pages
        create: default
        templates:
          - about
          - home
          - default

This setting in site.yml (in the example posted above) prevents creating new pages with any other template than the default one. You would have to remove this (and add the template as suggested)

1 Like

Thanks everybody for the help! :+1: