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

Second navigation?

Started by Muut Archive 11 years ago · 2 replies · 418 views
11 years ago

Hello everybody,
while developing my first site with GRAV, I'd like to set up a second navigation (footer). For this second navigation, I created a new folder in /user/ and tried to get the base.twig.html to read it out – not very successful.
Is there an easy way to set up a second nav just like the nav with pages-folder?

11 years ago

I think the best way is to put something like that in your site.yaml:

YML
footer_menu:
- url: "your_url_here"
  text: facebook
- url: "your_url_here"
  text: twitter

Then create footer_menu.html.twig in templates/partials, find a place to include it in your base.html.twig.
Then include it like that:

TWIG
{% include 'partials/footer_menu.html.twig' %}

And the last step, add following code in footer_menu.html.twig

TWIG
<ul>
{% for item in site.footer_menu %}
    <li><a href="{{ item.url }}">{{ item.text }}</a></li> 
{% endfor %}
</ul>

That's it. You should have your additional custom footer menu added.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1344 9 years ago
Archive · by Muut Archive, 9 years ago
2 930 9 years ago
Archive · by Muut Archive, 9 years ago
2 4058 9 years ago
Archive · by Muut Archive, 9 years ago
1 2943 9 years ago
Archive · by Muut Archive, 9 years ago
3 1116 9 years ago