Modular page > navigation

Hi guys,

First off, thank you for this brilliant piece of coding! I’ve played around with Grav for a few days now and decided to change a website that was running on drupal (overkill for such a simple 1-page website).

Im off to a pretty good start, got most of the custom theme down by now. Just the one-page layout navigation I can’t wrap my head around…

I’ve a modular.md which has the line onpage_menu: true, additional all of the _Page > text.md that i use for the content have a “menu: menu_title” in the yaml header.

In my header.html.twig i’ve the following code:

which in the end only generates the menu item that I provide in the modular.md, and not of the actual ‘modules’. Could someone point me into the right direction? I assume it has to do with my twig markup above. When checking the skeleton/theme of Boxify I notice some different markup. I tried using exactly that twig markup, but no avail.

from boxify i tried including the fo llowing:

{% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}

{% for module in row %}
{% if not module.header.hidemenu %}


  • {{ module.menu }}

  • {% endif %}
    {% endfor %}

    –```

    Additional question for bonus points… My ‘modules’ have all the same mark up, I assume having one e.g. text.html.twig and use text.md in _folder1 & folder2 would generate the same block twice, with different content… Unfortunately as soon as i use text.md for the second type it doesn’t display anything anymore, once i remove the second use of text.md, the first block shows up again.

    –```

    Apologies for the long question, Im really trying to get the hang of how Grav works as it seems the ideal solution for any website for which a full blown cms is overkill.

    Thanks,

    Laurens

    I think ceeve navigation.html.twig clearly demonstrates how to load both modular pages and single ones including custom links in site.yaml Take a look, copy and adjust it for your needs :slight_smile: Good luck :slight_smile: https://github.com/getgrav/grav-theme-ceevee/blob/develop/templates/partials/navigation.html.twig

    Regarding text.html.twig you have to remember about one thing. If text.html.twig is inside “modular” folder then it’s supposed to work with text.md modular pages. It will not work with single pages. And vice versa. If text.html.twig is inside templates folder then it will only work with single pages. It will not work with modular stuff.

    Thanks a lot for you reply! it did work, i was missing the following

    {% for module in page.collection() %}
    
    <li><a href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a></li>
    

    The navigation seems to work well now! thanks!

    Unfortunately regarding the text.md & text.html.twig not much changes… text.html.twig is in the folder templates>modular.

    it seems that Grav keeps using the default.html.twig that is in the templates folder. However as soon as i delete default.html.twig I get an error, although there is no content that is using the default.html.twig file or referring to it…

    any clue regarding this?

    the problem seemed to have changed slightly… the modular menu works fine now, the first content-block (module) shows up fine.

    the second content-block in pages > _page2 > text.md… keeps defaulting to display template ‘default’. when i actually tried to save it and my permissions were set wrong i noticed it said it can’t open/edit the file default.md… which is funny as there is no such file… there is a text.md file in that folder.

    Another weird issue is that the moment i delete the file default.html.twig from the templates > modular folder i get an error… I’ve replaced the default.html.twig with an empty file which seems to work.

    Any idea where i can find a possible setting that is causing Grav to default to default.md/default.html.twig?

    don’t see any option to edit my previous post

    If i upload the text.md file in the folder pages > _page2 > …[here]…

    and i check the admin plugin, it shows me that it’s set up with the display template default causing the missing default.html.twig error as well as not showing up at all, as i emptied default.html.twig as mentioned before.

    The moment i add the same page manually through the admin plugin, everything works out like it supposed to.

    so for some reason my Grav installation fails to link text.md to text.html.twig it seems… is that even possible?

    solved this issue, was caused by a free Markdown editor that added whitespaces/tabs in the MD-code causing a YAML front matter error.