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?
Archive
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.
Great, it works. Thank you!
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1344 | 9 years ago | ||
| 2 | 930 | 9 years ago | ||
| 2 | 4058 | 9 years ago | ||
| 1 | 2943 | 9 years ago | ||
| 3 | 1116 | 9 years ago |