Navigation menu list in Grav

Viewed 1021

I am new to Grav and I am trying to get the basics. If I want the following page structure:

root
|_______ set1 
|           |___ page_10
|           |___ page_11
|           |___ page_12
|
|_______ set2
|           |___ page_20
|           |___ page_21
...

How can I make set1 display a regular navigation menu with links to each inner page?

Something like:

- Page 10
- Page 11
- Page 12

Where each entry is an html link to each page.

1 Answers

You can do that with twig with something like this:

{% for childpage in page.header.children %}
<a href="{{childpage.url}}">{{ childpage.title}}</a>
{% endfor %}

This iterate through all the children of your page, and display a link and the page title.

Related