I’m trying to learn Grav to finally ditch Wordpress I hate. I want to create a website with Grav as support content edition. I’m currently moving the static page into modular version, so my copywriter can work on it. I’m using AI (Gemini and Copilot) for help (mostly as a docs-explainer and automation, I’m trying hard to avoid vibe-coding if anyone reading is allergic to that).
I’ve encountered a weird problem where Gemini tried hard to prove me wrong.
My file structure:
Blueprints: user/themes/my-theme/blueprints/modular/ → here be the example_section.yamls
Templates: user/themes/my-theme/templates/modular/ → here be the example_section.html.twigs
In .md files whenever I’m calling template: example_section → it doesn’t work.
When I have tried to debug this, I simply thought it’s dir issue, so I tried a specific path: modular/example_section → it works!
Gemini fought with me that’s unusual and against convention, but I have failed to find a solution via google. Any tips on how to debug it? I tried both Gemini and Copilot, but they just went on a wild goose chase, Copilot decided to generate a loop to add modular/ as a prefix and called it a day (lmao) while Gemini gave up and decided my grav installation is screwed. I’m using Grav v1.7.50.8 - Admin v1.10.49.1
Any tips? I’ll probably go on using modular/ as a prefix to the .md templates for now, but I’d like to do a course-correction if I’m doing sth wrong here.
Nah, everything works, I was just wondering about the specific file routing conventions. Gemini claimed I should point to user/themes/my-theme/templates and Grav will automatically scan all the subfolders of tempelates to get the correct html.twig. However, I need to point directly to the template/modular for the Grav to find my example.html.twig that sits there (just pointing to templates doesn’t work).
To sum up, in .md file:
template: example → doesn’t work
template: modular/example → works just fine
I’m wondering if I’ve got a bug there and I’m using a workaround or if the AI was gaslighting me.
@kocieTexty00, You can override the template inside the frontmatter of a page (*.md), but the Grav way is to name the page file itself according the template to be used.
In above tree, since the folder name starts with an underscore (02._highlights/features.md), Grav will automatically apply the features template found inside the modular/ folder.
So, I get that Gemini is correct and if features uses templates/modular/features.html.twig
all it should point out to template: features and Grav does not need the modular/ prefix. Got it. Thanks a lot. I gotta read the docs carefully someday. Probably started working with Grav ass-backwards, lol.