Modular page blueprints load, but their custom fields don’t appear in Admin

I’m working on a custom theme and creating new modular sections. Grav does detect the modular types (they appear in the template selection dropdown), and the .html.twig and .yaml files are all in the correct folders:

  • user/themes/nemora/templates/modular/hero.html.twig

  • user/themes/nemora/blueprints/modular/hero.yaml

However, the issue is that the custom fields defined in the modular blueprint do not appear in the normal Admin view when editing the modular page. Only the default fields show up, even though the YAML blueprint extends the correct page type and has valid syntax.

Important details:

  • The page blueprint and the theme blueprint do show correctly in Admin

  • Only the modular blueprint’s fields fail to appear

  • The modular type itself is listed and selectable

  • Cache has been cleared multiple times

  • YAML indentation and naming match the template exactly

So Grav recognizes the modular template but ignores the blueprint fields.

What could cause Admin to skip rendering the modular blueprint fields even though the file structure is correct and the blueprint is loaded?

Links to the relevant files (with the same structure)

@aev, I cannot reproduce the issue…

I’ve copied your blueprint from Proton into blueprint /user/themes/quark/blueprints/modular/hero.yaml and I get the following result in Admin.

So your pages do show up in Admin and the data is saved properly into hero.md

@pamtbaau Thank you for the quick response!
The issue was with blueprints directory.
Here is a detailed solution for anyone discovering this too:

What exactly was the issue with the blueprints directory?

My directory was

├── blueprints
│   ├── modular
│   │   └── hero.yaml
│   └── pages
│       └── knowledge.yaml
        

It now works as expected when I moved modular inside pages

├── blueprints
│   └── pages
│       ├── modular
│       │   └── hero.yaml
│       └── knowledge.yaml

I didn’t include the knowledge file when sharing as I thought it didn’t matter. It did :smiley:

@aev, That still doesn’t clarify it for me… Anyway, your issue has been solved.

Grav skips blueprints inside the theme/blueprints/modular folder as long as the theme/blueprints/pages folder exists, even if this folder is empty.

When creating blueprints in a theme, IF the pages directory is exists (even if empty), the modular blueprints must be nested in the pages directory. Else they can be in the blueprints/modular directory .

@aev, I’m puzzled…

Using the “One-Page Site” (uses a modular home page) skeleton, I have…

  • created an empty folder /user/themes/quark/blueprints/pages/

    user/themes/quark/blueprints
    ├── blog.yaml
    ├── default.yaml
    ├── item.yaml
    ├── modular
    │   ├── features.yaml
    │   ├── hero.yaml
    │   └── text.yaml
    ├── modular.yaml
    ├── pages                <== Empty folder
    └── partials
        └── blog-bits.yaml
    
  • Added an extra field in /user/themes/quark/blueprints/modules/text.yaml

    title: Text
    '@extends': default
    
    form:
      fields:
        tabs:
          fields:
            content:
              fields:
                header.media_order:
                  label: Page Media (first one will be displayed next to your content)
                header.image_align:
                  type: select
                  label: Image position
                  classes: fancy
                  default: left
                  options:
                    'left': 'Left'
                    'right': 'Right'
                header.myfield:
                    type: text
                    label: My Field
                    description: 'This is My Field'
    
  • Field ‘myfield’ is perfectly shown in Admin at the bottom of tab “Content” and its data is saved into the page file.

Maybe it has to do with how you “extend” the blueprint. IIRC, your extention section, at the top of the module, had something with “pages” in it.