Vajna Botond

Designer

How to Group Custom Page Templates in Grav Admin

When building a custom Grav theme, you’ll often create your own page templates and blueprints. By default, these templates simply appear in the Template dropdown in the Admin Panel, mixed together with Grav’s core templates.

If you’d like your custom templates to be listed under their own section in the dropdown (for example, “Custom” or “Theme-specific”), you can do this by defining a title and form structure in your blueprint file.


Example: eventschild.yaml

Let’s say you created a Twig template at:

/user/themes/gravatan/templates/eventschild.html.twig

To make this template selectable in Admin, you also need a blueprint file:

/user/themes/gravatan/blueprints/eventschild.yaml

Here’s how you can structure it so it shows up cleanly in its own section:

title: Events Child
form:
  validation: loose
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          title: Content

          fields:
            header.title:
              type: text
              label: Page Title
              autofocus: true

            content:
              type: textarea
              label: Page Content
              rows: 10

How It Works


The Result

When you edit a page in Grav Admin and switch to the Advanced tab, you’ll see the Template dropdown. Instead of appearing in the middle of Grav’s built-in templates, your new Events Child template will be grouped clearly in the dropdown, making it easy to distinguish theme-specific templates from the defaults.


Why This Is Useful


👉 Tip: You can repeat this approach for every custom template you add to your theme. Each blueprint with a title will appear as its own selectable option in the Admin template dropdown.