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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Can one have some anchor links included in the menu?

Started by zoof 8 years ago · 4 replies · 2524 views
8 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!

8 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
8 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
8 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 Pedro M, 2 months ago
4 192 2 months ago
Themes & Styling · by Ian, 2 months ago
3 89 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 447 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 42 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 122 3 months ago