GRAV One-Page Antimatter Theme

I like the modular layout for the home page of the Antimatter One-Page theme but I would like to add menu links to other pages…do I edit modular.html.twig to accomplish this?

In the modular.md file that is the parent of the modular pages (probably user/pages/01.home/modular.md you can add/edit the header variable:

onpage_menu: false

This will turn off the onpage ‘modular’ menu and instead use the regular page structure to build the pages.

However, if you want to mix both the onpage modular page menu AND the regular page structure-based menu, the simplest thing is to leave the on-page menu (as that dynamically adds the named links), and then simply add your other menu items manually via the site.yaml:

menu:
    - text: Source
      icon: github
      url: https://github.com/getgrav/grav
    - icon: twitter
      url: http://twitter.com/getgrav

I just realized this menu stuff is not documented. I have made a note to add this to the documentation.

Thanks for the help. I went with the onpage_menu: false solution which got the navigation the same on all pages. I tried adding the menu items from your post to my site.yaml but they do show up on any of the pages?

Here is my user\config\site.yaml:

author:
email: info@pagetech.com
name: “Page Technology Marketing, Inc.”

metadata:
description: "PCLWorks is the perfect solution for viewing, converting, and debugging PCL print streams. Quickly and easily convert PCL to PDF and other output formats."
title: PageTech

menu:

Please use a code block for your site.yaml paste ( see help icon in top right of forum post box)

Spacing is critical for yaml.

Also check to make sure antimatter theme is up to date. bin/gpm update

Ran the update command and there they were!

Thanks,

Brad

Has this changed since April, because menu items added in site.yaml won’t show when onpage_menu: true?

Antimatter’s modular.html.twig does not include the site.menu. Add this snippet

        {% for mitem in site.menu %}
            <li>
                <a href="{{ mitem.url }}">
                    {% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
                    {{ mitem.text }}
                </a>
            </li>
        {% endfor %}

in that file, to add it.

@rhukster should we add it by default?

Yah that logic was never in the ‘onpage menu’, but probably should be.

@flaviocopes Thanks that worked.

I have a problem. When onpage_menu: true and I add a page on site.yaml, the link is shown on the menu, but nothing happens when it’s clicked (the link is pointed correctly, but it simply doesn’t work). I have everything up to date. Any ideas?

1 Like

What is the HTML generated for that link?

This is the HTML:

  • Blog
  • Then the link is fine. Could be the CSS causing problems with the z-index of the elements?

    I have the same problem. The new menu items are there, but clicking on them does not work.
    Even if I set the url directly through e.g. Firebug , it does not work. Also tried playing with z-index. No results.

    Hmm…after a couple of refreshes…it works now. #strange

    Did you disable the cache?

    I guess that was my problem

    How can I change the order of the menu items, so that the modular page menu items display first and then the rest of the pages?