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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Hide a certain modular subpage from the navigation bar

Started by Stefan 9 years ago · 13 replies · 3624 views
9 years ago

Hello,
how can you hide a certain modular subpage from the navigation bar of the page?
greeting
Käpsele

9 years ago

Try visible: false in the page frontmatter? If you are using the Admin Panel this option is also available when editing a page.

last edited 10/21/17 by Paul Hibbitts
9 years ago

Thanks for your answer!
Yes, i did this, but it doesn`t works.
I have found this option in the "Normal"-tab, not in the Advanced-tab.

Have you another idea for solution?

last edited 10/21/17 by Stefan
9 years ago

I use Template "Halcyon".
The cache is disabled.
I've seen it work in another template.
Possibly. Can I take the code from there?

Edit:
i have the solution: write in the page-header: "hidemenu: true"

last edited 10/22/17 by Stefan
9 years ago

Awesome, great to hear you found a solution!

8 years ago

How would you solve this in the "Antimatter" theme? I've tried what you write here and also in different other threads, but it seems not to work on Antimatter.

8 years ago

Hi @werdi, what exactly do you want to do with Antimatter?

8 years ago

Hi Paul,

thanks so much for your reply.

The question is about how to hide a certain modular subpage from the navigation bar.

For example:

01.home

_subpage1

_subpage2

_subpage3

Imagining you want to hide subpage 2 from the navigation bar.

You suggested a helpful solution in this thread for the Halycon theme (i believe), which includes pasting some code in the modular.html.twig file. That didn't work for my Antimatter theme.

Do you know a solution for the Antimatter theme?

Thanks so much.

8 years ago

Hi @werdi , you could add a check for page visibility in the modular.html.twig, like this:

TWIG
        {% for module in page.collection() %}
          {% if module.header.visible %}
            {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
            <li class="{{ current_module }}"><a href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a></li>
          {% endif %}
        {% endfor %}

And then in each of your modular pages set visible to true or false, like this:

TXT
visible: true

Let me know if that works for you.

👍 1
8 years ago

Thanks for your answer. I tried it and it seems to confuse things. The item in question appears twice on the navigation, instead of disappearing. Did I get something wrong?

8 years ago

Please ignore my last message. It didn't work - (and the double appearance was a mistake on my part, but still it didn't work). What am I missing?

8 years ago

This was a great tips. I used it for Quark "on-page" menu in modular.html.twig file inside block "{% block header_navigation %}":

TWIG
        {% for module in page.collection() %}
        {% if module.header.visible == true %}
        {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
        <li><a class="{{ current_module }}" href="#{{ _self.pageLinkName(module.menu) }}">{{ module.title }}</a></li>
        {% endif %}        
    {% endfor %}

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 76 8 hours ago
General · by pamtbaau, 13 hours ago
1 47 13 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago