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

GRAV One-Page Antimatter Theme

Started by Muut Archive 11 years ago · 22 replies · 1124 views
11 years ago

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?

11 years ago

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:

TXT
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:

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

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

11 years ago

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: [email protected]
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:

11 years ago

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.

11 years ago

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

11 years ago

Ran the update command and there they were!

Thanks,

Brad

11 years ago

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

11 years ago

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

TWIG
        {% 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?

11 years ago

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

11 years ago

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
11 years ago

What is the HTML generated for that link?

11 years ago

This is the HTML:

<li>
<a href="/gravcustos/blog">
Blog
</a>
</li>

11 years ago

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

10 years ago

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.

10 years ago

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

10 years ago

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?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2956 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago