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 →

How to create two menus

Started by M 6 years ago · 1 replies · 765 views
6 years ago

Hi,

I want to migrate a older project to Grav. The site has two menus: a horizontal one at the top and a vertical one on the right side. Can this easily be realized with Grav?

Best regards
Michael

6 years ago

@myscha, Each menu is nothing but a listing of a page collection. In Twig the variable pages is a collection of descendants of folder 'user/pages' and is usually used in the horizontal top menu.

In Twig you can create a collection dynamically or use the existing collection of the current page (e.g. page.children). This collection could then be rendered vertically in the sidebar.

Using the above, you could for example create a horizontal menu of only the children of folder 'user/pages' (no dropdowns in menu) and a vertical menu of the list of children of the current page (instead of the dropdown).

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by MarkP, 7 days ago
3 121 3 days ago
Themes & Styling · by TomW, 6 days ago
0 64 6 days ago
Themes & Styling · by themetman, 2 weeks ago
1 159 1 week ago
Themes & Styling · by AH, 4 weeks ago
1 274 2 weeks ago
Themes & Styling · by Bruno, 4 years ago
6 1458 2 weeks ago