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

Something about onpage_menu

Started by Muut Archive 11 years ago · 1 replies · 435 views
11 years ago

Hi, everybody,

I tried onpage_menu, I like it, but I have some suggestions.

First, when I have a multipage, sometimes I like to have the menu item of only some of the pages.
I solved writing this in modular.html.twig:

TWIG
 {% for module in page.collection() %}
    {% if module.menu != '@hide' %}
        {% 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 %}

but would be better to add a directive in the subpage as:

TXT

title: My subpage
hidemenu: true

TXT
# my title
my text

Second, the onpage menu items are added at the end of other itens ie:

Home | page2 | page3 | subpage1 | subpage2

I think would be better to show onpage items near the main page:

Home | subpage1 | subpage2 | page2 | page3

Best regards and thanks.
Claudio

11 years ago

You can use the visbible setting on a page as the intention of this is to hide an item from the menu. Then you can check this is not false. A PR would be welcome!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1349 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2946 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago