Grav: Submenus possible?

Created on 29 Aug 2014  Â·  9Comments  Â·  Source: getgrav/grav

There is no word about submenus - are they possible with the current code?

question

Most helpful comment

would be great could create custom menus like this


menu:
    - text: menu
      url: https://github.com/getgrav/grav
       - icon: submenu here
         url: http://twitter.com/getgrav

is there any way for achieve this? thanks

All 9 comments

Yes, possible and even pretty simple. I plan on writing some documentation about it. The best way is to use a macro. I'll post a code snippet here in a bit.

Thanks, that would be very nice :) i need it urgently for a customer project

Am 29.08.2014 um 16:08 schrieb Andy Miller [email protected]:

Yes, possible and even pretty simple. I plan on writing some documentation about it. The best way is to use a macro. I'll post a code snippet here in a bit.

—
Reply to this email directly or view it on GitHub.

Thanks .. but I'm still confused about the frontend styles for the dropdown at the antimatter theme (i am not a frontend developer). I wish the dropdown styles would be already included within the antimatter theme (a style which looks good and matches to the antimatter theme). I'm willing to donate such a solution, but I need it really quick :+1: Can anyone help here with the styling?

We're all busy working on other things at the moment. But I did add a cookbook entry in the documentation, and at the bottom are several great tutorials on how to style a dropdown menu that should work fine with just minimal tweaking:

http://learn.getgrav.org/cookbook/dropdown-menu

The page has been remove, where could I find it now?

I think it got removed since dropdown menus are currently implemented in themes, Antimatter and other ones as well.

E.g. https://github.com/getgrav/grav-theme-antimatter#dropdown-menu

would be great could create custom menus like this


menu:
    - text: menu
      url: https://github.com/getgrav/grav
       - icon: submenu here
         url: http://twitter.com/getgrav

is there any way for achieve this? thanks

{% set current_parent = page.parent.parent.title %}
{% set options = { items: {'@page': '/' ~ current_parent|lower}} %}
{% set my_collection = page.collection(options) %} 

<h3>{{ current_parent }}</h3>
<ul>
        {% for p in my_collection %}
        {% set current_page = (page.parent.title or p.menu) ? 'active' : '' %}
          <li class="arc-submenu-list {% if (page.parent.title |lower) == (p.menu |lower) %} active {% endif %}">
            <a href="{{ p.url }}">{{ p.menu }}</a>
          </li>
        {% endfor %}
</ul>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

escopecz picture escopecz  Â·  17Comments

ekumlin picture ekumlin  Â·  37Comments

giansi picture giansi  Â·  17Comments

balajmarius picture balajmarius  Â·  17Comments

diazwatson picture diazwatson  Â·  60Comments