Can one have some anchor links included in the menu?

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!

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:

And here is the related Twig at work, with Antimatter:

This Twig might also be of interest (used to add menu items for Modular page sections):

@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 Like

I managed it in a completely hacky way – I manually added menu entries in site.yaml and deleted the for-loop that looks for menu entries: https://github.com/getgrav/grav-theme-antimatter/blob/develop/templates/partials/navigation.html.twig#L29-L38

Maybe there is a nicer way???

1 Like

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