Template header throws exception

I’m building a site using modular pages, and I have come across this problem:

I want to have two modules on the same page use the same template. I read the documentation and came across the “template” header:


Now, this seems straight forward. I select the template by writing it into the header. Right?

So if I have two different modules, each supposed to use the template “textblock”, then I should just put the following into the header of the modules’ .md files:

template: textblock

However, when I do this, Grav throws an exception:

An exception has been thrown during the rendering of a template (“Template “textblock.html.twig” is not defined ().”) in “modular.html.twig” at line 4.

And, well. There is a textblock.html.twig in the correct place, and it renders correctly as long as I don’t write the template into the header.

Am I missing something? What’s wrong?

First, i’m not sure you are understanding the mechanics of modular pages. I strongly suggest you download the onepage skeleton and have a look how that page is built. You will see there is a parent page that mere is the container for multiple child pages. Each of those child pages are in their own folder and are named according to their template.

There are in fact 2 different pages that are features.md files and because they are modular (in _ prefixed folders), they use modular/features.html.twig template by default. There is no need to set the template explicitly.