Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Remove modular item from nav

Started by Muut Archive 10 years ago · 3 replies · 487 views
10 years ago

I have been slamming my head against a wall on how to remove a particular modular page from the nav. I made the homepage hero of the site it's own modular section to make it easily updatable through the admin console, but of course it shows up as a nav item. Is there anyway in the YAML front matter to say "hey don't show this module in the nav" or do I have to do some fancy twig to make it disappear? I have also toyed with the idea of making it a partial and not part of the modular page set up, but not possible to edit for the person I am delivering this site to.

10 years ago

Depends on the theme used, in Antimatter you can set onpage_menu: false in the page header.

10 years ago

In Antimatter theme for example, there is a special onpage_menu option that triggers a loop in the templates/modular.html.twig file. This is what is looping over the modular items and building the onpage menu.

You could theoretically use a flag in each modular page header to determine if it should be included in this loop or not. Then you simply check this value as you loop.

That way you can skip certain modular pages so they don't show up in that onpage menu.

10 years ago

Perfect, makes sense. I will play with that. Thank you.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago