Placeholders in site.yml not showing in panel

Dear team, we just started our first kirby-project. So we’re quite new to everything. (Version 3.6.4, PHP 8, just installed yesterday)

I found this very useful cookbook entry, which should make placeholders in site.yml available for the user: Placeholders | Kirby CMS

But when I embed this into my site.yml, the panel shows nothing. I might have put it in the wrong place / indention :interrobang: So here is my site.yml:

# The `site.yml` blueprint defines the look of the start page (Dashboard) of the Panel.

# The site blueprint usually provides easy access to all main pages of the site.
# In this example blueprint, we also show subpages of the `photography` and `notes` pages.
# More about the site blueprint: https://getkirby.com/docs/reference/panel/blueprints/site

# The layout of this form has two columns:
columns:
  - width: 1/2
    sections:
      pages:
        type: pages
        create: default
        templates:
          - about
          - home
          - default

  - width: 1/2
    sections:
      notes: sections/notes

placeholders:
  label: Text replacements
  type: structure
  fields:
    key:
      label: Placeholder key
      type: text
      help: >
        The key is what you use in your textfields, e.g. {{ company }}
    value:
      label: Replacement text
      type: textarea
      help: >
        The replacement text is the text that will replace your keyholders.

What did I do wrong?

If I indent the placeholders one level to the right, nothing shows either. If I indent even one level more (in my understanding it should then “live” in the second column), I get this error:

Hello, welcome to our forum.

Cool!

You placeholders field must live within a section, you could, for example, start a new column with a new section:

columns:
  - width: 1/2
    sections:
      pages:
        type: pages
        create: default
        templates:
          - about
          - home
          - default

  - width: 1/2
    sections:
      notes: sections/notes
  - width: 1/1
    sections:
      fields:
        placeholders:
          label: Text replacements
          type: structure
          fields:
            key:
              label: Placeholder key
              type: text
              help: >
               The key is what you use in your textfields, e.g. {{ company }}
            value:
              label: Replacement text
              type: textarea
              help: >
               The replacement text is the text that will replace your keyholders

As an alternative, you could move the field to other tab: Layout | Kirby CMS

1 Like

Ok, great – this seems to work (at least somehow). Now I get this message:
image
I replaced my whole site.yml with your code

Oh, sorry, I missed the section type:

sections:
      fields:
        type: fields
        fields:
          placeholders:
            label: Text replacements
            type: structure
            fields:
              # structure fields here

Great now it works – maybe this should be added/edited in the cookbook?

for the sake of completness, this is the final solution for site.yml:

columns:
  - width: 1/2
    sections:
      pages:
        type: pages
        create: default
        templates:
          - about
          - home
          - default

  - width: 1/2
    sections:
      notes: sections/notes
  - width: 1/1
    fields:
      placeholders:
        label: Text replacements
        type: structure
        fields:
            key:
              label: Placeholder key
              type: text
              help: >
               The key is what you use in your textfields, e.g. {{ company }}
            value:
              label: Replacement text
              type: textarea
              help: >
               The replacement text is the text that will replace your keyholders

Just as an extra note, the top part of this block right here:

- width: 1/1
    sections:
      fields:
        type: fields
        fields:
          placeholders:
          ...

Can be rewritten as this if you prefer to have fewer lines in your blueprints

- width: 1/1
  fields:
    placeholders:
    ...
1 Like

Thanks @manuelmoreale – I edited the solution according to your shorter version :+1:

1 Like