How to add custom fields for all page template without creating individual blueprints?


I have several types of pages with unique blueprints but i need to create custom fields which will work on all types of pages. How can I do that?


I am not sure if you have a multisite or default setup. I solved this (on my multisite setup) by augmenting the environment setup of the ‘blueprints’ stream as follows:


use Grav\Common\Utils;

return [
'streams' => [
  'blueprints' => [
                 'type' => 'ReadOnlyStream',
                 'prefixes' => [
                     '' => [

I assume you could just put this into a setup.php file.

What this does, it augments the blueprints streams and loads the blueprints folder in /user/blueprints.

Now, make a folder

/user/blueprints/pages - and this behaves then as a replica of the /system/blueprints/pages folder – look into it to find the root blueprints.

Here’s an example then of a blueprint extension for default.yaml:


  type: default
  context: blueprints://pages

      type: tabs
      active: 1

            unset@: true
            type: ignore


                  type: text
                  label: My custom field
                  toggleable: true
                  help: This is the tooltip for the field
                  ordering@: 1

Note the ordering - can be >1. Negative values will assume this field is at the BOTTOM of the fields list and will then decrease that index, so to put something all the way at the top, you’d do e.g -99 :slight_smile:

Good luck!