Block problem with Pages

Hello,

I started learning Kirby a few weeks ago, but I’m stuck on a problem I can’t figure out. I don’t have access to blocks when creating a new page in the Panel. I created blueprints, templates, etc., but nothing works—blocks are never available on my pages as they are on the default “About Us” page… Did I miss something? Thank you for your help.

Welcome! Can you share your blueprints? Did you create a new page using your blueprint and template? Kirby will always fall back to using the default template if the required one is missing. When you create a new page, there is an option to choose the template based on the available templates.

You can paste code in this forum but please use three backtick charachters at the begginning and end of the code sample to get it formatted in a readable way in the post.

Thank you for your answer ! Well, my infos.yml is build like this :


status:
  draft: true
  listed: true

options:
  changeTemplate : true
  create : true

tabs:
  content:
    icon: text
    label: Content
    fields:
      layout:
        label: Layout
        type: layout
        layouts:
          - "1/1"
          - "1/2, 1/2"
          - "1/3, 1/3, 1/3" ```

I also created a template : 
```<?php snippet('header') ?>

<main>
  <?php if ($page->content()->isNotEmpty()): ?>
    <?= $page->blocks()->toBlocks() ?>
  <?php endif; ?>
</main>

<?php snippet('footer') ?> ```

So i did this two files, but nothing happened in my panel. When i want to add a Page, i can only give a name and and url. No model template, nothing.

Ok so a snippet is not the same as a template. Snippets allow you to keep bits of code in seperate files so that you can reuse them in multiple templates This is especially useful for things like headers and footers and menus which will be used on multiple page templates.

Edit: Having re read your post (it wasnt quite formatted properly) i can see that you might have a template after all, but does it have the correct name (infos.php)

You need to create an infos.php file in the template directory and make sure that the content file for this new page you have created is called infos.txt rather then default.txt. I suspect that Kirby has used the default template because you do not have the infos.php template. This is likely why you are not seeing what you are expecting.

You might find the first few videos in the Kirby Basics Screen cast playlist useful to understand what is going on here. https://www.youtube.com/watch?v=EDVYjxWMecc&list=PLTep5U-3mg9EfgnQ08XDRs4vSOmhw2JWz

You need a loop in the template to display all the blocks correctly. Please refer to the blocks documentation - Blocks | Kirby CMS

Check with which filename your newly created pages end up in the content folder. I’d assume you don’t create new pages with the new template, but with the default one.

If that’s the case, we need to find out where you want to create the new pages with this blueprint.