Simple links in the navigation?! How to?

Hi, I was wondering how could I set links in the navigation? Is there any configuration to set for that, or should I explicitly override the navigation template?

Very good question!

I think I should override, since it is leading to external pages, I don’t need to have the ‘active’ class on it.

As you say, create your new theme based on the default antimatter theme, by copying the antimatter folder with a new name (also renaming the .php and .yaml files to match. Then set this new theme to be your default in your user/config/system.yaml file.

After that you can edit the template/partials/navigation.html.twig to add your own custom external links.

If you want to have internal redirects, you can do this with a simple redirect page as outlined in this blog post

Ok, I’ll do. Thanks for answering.

Very useful, thanks. I will try it

I have done all the steps described in @rhukster 's post but i can’t get it to work.
(1. Copied antimatter folder and renamed it as anti-matter
2. renamed .php and .yaml files to anti-matter.php etc…
3. edited system.yaml
3. edited navigation.html.twig)

No matter what edit i make in navigation.html.twig nothing changes… Even if i delete all the lines and leave the file empty nothing changes…

Ps. I 'm trying to add an external link (‘blog’) after the default Top Highlights Easy Content Features links.

My hunch is that you have not created a copy of antimatter and changed your theme to it?

Before starting, Grab the latest version of Grav (released a couple of days ago).

Basically Grav ships with user/themes/antimatter you should copy this entire folder to a new folder name, for example user/themes/mytheme.

Next you need to tell Grav to use this theme rather than antimatter. So, edit your user/config/systeml.yaml file and change the pages: theme: antimatter entry to be pages:themes: mytheme

A this point any changes you make in mytheme will show up on your site.

If you are still having problems, try clearing your cache with the CLI: bin/grav clear-cache from the root of your Grav site.

The problem was that i was editing
templates/partials/navigation.html.twig
while i had to edit templates/modular.html.twig.

In case anyone else wonders, editing navigation.html.twig is good for making changes on the navigation bar of “standard” and “listing” pages but you have to edit modular.html.twig for the modular ones.

Thank you!

I’ve actually added an option in the antimatter theme (v1.1.7) that lets you use onpage_menu: false in the modular.md page headers so this means you can enable/disable the modular on-page-menu without having to mess with the theme.

You can update to this version of antimatter (although it will overwrite any changes you made) with bin/gpm update

Since my theme is based on Antimatter, and Antimatter continues to improve, is there an easy way to let my theme take advantage of those improvements?

In these situation, As I know your on a mac, I would strongly advise using a diff/merge tool such as Kaleidoscope although it’s a bit pricey it is excellent.

Another option is Visual Differ that’s only $5.

These will allow you to quickly and visually compare two folders and ‘merge’ in any changes you wish.

Good idea. I have Kaleidoscope and I’ll give that a try.

@rhukster
I’ve actually added an option in the antimatter theme (v1.1.7) that lets you use onpage_menu: false in the modular.md page headers

I think i 'll try that because for modular pages when i edit templates/modular.html.twig in order to add a new external link, while the link appears, it’s unclickable :o (actually middle clicks works and opens the link in a new tab (and even that only on ff and ie), but left click does nothing…)

That sounds like a browser issue because that’s not something we can even control/change with HTML/CSS.

@rhukster
I’ve actually added an option in the antimatter theme (v1.1.7) that lets you use onpage_menu: false in the modular.md

I 've tried it and works well. Thank you.

I guess that we can’t somehow mix the functionality of onpage_menu: true (with which we can move up and down the modular page from the navigation bar) and the simplicity of having to deal only with navigation.html.twig to edit/add links. Right?