Blueprint Snippets

Hi there,

at the moment I’m quite often copying/pasting field definitions in the blueprints as I have some pages with similar content structure but different templates. Is there an option for blueprint snippets so that I can compose my blueprints like my templates?


If it’s only one blueprint you need for multiple templates “default” is the way to go - otherwise I don’t think there are snippets for blueprints… but it’s a good idea! :blush:

1 Like

I have never tested it, but maybe you could actually do include a file with shared field definitions - since the blueprint is a php file?

Oh that’s a great idea, I’m going to give this a quick try later

Any insights @FabianSperrle?

Global field definitions are now a feature in Kirby 2.2.

Not working for me. I keep getting a missing panel fields error message when I log into my panel.

Could you post the content of your Blueprint, and let us know what files you have in your site/blueprint/fields folder?

Home Yml

Process Yml

Testimonial Yml

Home PHP

Process/Testimonial PHP

This is not the way it works, you can only define single fields, not import complete blueprints. Pls. check out the docs:

1 Like

I’ve been using mustache and gulp to import bigger parts of blueprints, I could show you my gulpfile if you want.


Any way to import complete fields?

The most basic implementation of a blueprint snippet is essentially what I imagine you’re describing as importing a “complete field.”

From the documentation:

# /site/blueprints/mypage.yml
    label: Title
    type: text
  field_name: your-blueprint-snippet # -> adds site/blueprints/fields/your-blueprint-snippet.yml

The reason you have to include one blueprint snippet at a time is because it must have a unique name or “key,” which is how the data is saved and retrieved by the Panel and your templates. In the example above, field_name is what you’ll use in your template to refer to the data. your-blueprint-snippet is the name of the snippet in site/blueprints/fields. That file would look something like this:

label: Testimonial
type: textarea
icon: quote-left

It’s true that you may need a lot of snippets to handle what you’ve shown us, but I think there are other ways you can go about simplifying your blueprints, particularly with the Structure field for the places where you have field names with numbers.

1 Like