Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

How to create two menus

Started by M 6 years ago · 1 replies · 609 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 FrViPofm, 11 hours ago
0 20 11 hours ago
Themes & Styling · by stuart young, 1 month ago
3 480 1 month ago
Themes & Styling · by Sebadamus, 2 months ago
5 481 2 months ago
Themes & Styling · by martynfoster735, 2 months ago
1 460 2 months ago
Themes & Styling · by Justin Young, 2 months ago
1 490 2 months ago