Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Second navigation?

Started by Muut Archive 11 years ago · 2 replies · 574 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 Muut Archive, 10 years ago
1 673 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago