Skip to content
Grav 2.0 is officially stable. Read the announcement →
Themes & Styling

Can one have some anchor links included in the menu?

Started by zoof 9 years ago · 4 replies · 2741 views
9 years ago

Hi,

I'm wondering how easy it is to customize the menu in grav. In particular, I have a page with several section heads/anchors, two of which I would like added to the menu. Any ideas on how to do this?

Thanks!

9 years ago

Hi @zoof, what theme are you using? One option with some themes is to add custom menu entries to the site.yaml file, here is an example:

https://github.com/hibbitts-design/grav-skeleton-course-hub/blob/master/config/site.yaml#L29-L33

And here is the related Twig at work, with Antimatter:
https://github.com/getgrav/grav-theme-antimatter/blob/develop/templates/partials/navigation.html.twig#L40-L47

This Twig might also be of interest (used to add menu items for Modular page sections):
https://github.com/getgrav/grav-theme-antimatter/blob/develop/templates/modular.html.twig

last edited 01/28/18 by Paul Hibbitts
9 years ago

@paulhibbitts, Many thanks! I'm using Antimatter and I tried your first suggestion and that worked great, adding entries at the end of the list. Is there any way to insert them before the end?

I started by trying Modular page sections but I didn't like the way it looked.

👍 1
9 years ago

Glad you got something working @zoof ! I myself do not know a better way that that, maybe someone else here might??

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by stuart young, 2 weeks ago
3 251 2 weeks ago
Themes & Styling · by Sebadamus, 3 weeks ago
5 317 2 weeks ago
Themes & Styling · by martynfoster735, 4 weeks ago
1 310 4 weeks ago
Themes & Styling · by Justin Young, 1 month ago
1 348 1 month ago
Themes & Styling · by Slebeig, 2 months ago
4 474 2 months ago