Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Can one have some anchor links included in the menu?

Started by zoof 9 years ago · 4 replies · 2858 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 FrViPofm, 2 weeks ago
4 391 5 days ago
Themes & Styling · by johan thomas, 5 years ago
1 751 2 weeks ago
Themes & Styling · by stuart young, 2 months ago
3 609 2 months ago
Themes & Styling · by Sebadamus, 2 months ago
5 622 2 months ago
Themes & Styling · by martynfoster735, 2 months ago
1 595 2 months ago