Having trouble creating modular template for new theme

I am new to grav, and have been playing around with it for the last week, and reading a lot of the documentation and viewing layout examples etc. I am starting to wrap my head around Twig, but I still can’t manage to figure out how to get the modular templates to work in a new theme.

I don’t want to inherit from a theme or start off by using a skeleton. Despite the fact they they are called skeletons I have seen many of them require you to bootstrap your theme using their chosen libraries. Take out their libraries and things you don’t need and you wind up with a barebones new theme which is where I am right now anyway :P.

Currently I have used the devtools to create a new theme which does not actually come with the modular template. I tried moving over the existing templates from the antimatter theme but they don’t work. I must be missing some other required files. I copied over the blueprints as well. I am not sure what else is required.

To summarize, I am creating a new theme for the website I am working on. I don’t need a lot because it is a simple project, however, I cannot get the modular templates to work by copying them over from the default antimatter theme.

docs are pretty clear even though modulars are little tricky

So create a folder structure like :

in modular.md

title: One Page Demo Site
menu: Home
onpage_menu: true
body_classes: "modular header-image fullwidth"

    items: '@self.modular'
        by: default
        dir: asc
            - _showcase
            - _highlights
            - _callout
            - _features

theses are your modulars, and also the order of appearance

- _showcase
- _highlights
- _callout
- _features

then inside modular folder, put md file. example : text.md

The template file for the text.md file should be located in the /templates/modular-folder of your theme, and should be named text.html.twig

in your twig for example

<div class="modular-row callout">
    {% set image = page.media.images|first %}
    {% if image %}
        {{ image.cropResize(400,400).html('','','align-'~page.header.image_align) }}
    {% endif %}
{{ content }}

You can also add a blueprint file for the text.md file should be located in the /blueprints/modular/ of your theme, and should be named text.yaml

I do understand, I reviewed the docs and they do appear clear, I just cannot get them to work the way everything is described. I feel like there is something missing from the docs that is not mentioned.

When I start from a premade theme it is very simple to create new modular pages and reorder them etc. If I copy the required template files, and create the same structure in my own barebones theme (literally just created), it does not render any modular content.

Just as the documents suggest I created the modular folders within a page, supplied the modular.md file in the root of that page, and provided a md file that corresponds to a modular template file within each of the module folders.

It’s very clear how to create new module pages if you already have the module system setup in grav, but it doesn’t very clearly explain how to setup the modular components so you can begin to utilize it for new projects / themes. I was undet the impression this was a feature out of the box but when I create a new theme using devtools it didn’t have any module templates at all.

I just want to get it working with a single line of text and I can run with it. I have tried many things, copying files from the antimatter theme, other skeletons, tried creating my twigs.

I got something really basic working now. I installed the admin package and created some pages through the gui to get me started. I feel stupid, and still have no idea what I was doing wrong as the structure and files look exactly the same :P.

The sub pages are not showing up under “pages” in the admin menu though, even though I created them through there. I imagine that is probably a blueprint thing?

When creating module pages, do I HAVE to use templates from the module folder, or can I reference a separate template file outside of the template folder, such as default.html.twig?