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.

Support

Hide Home in navigation menu

Started by gravus 9 years ago · 2 replies · 4935 views
9 years ago

I want to hide Home from navigation, and found this old issue which got me on track: /forum/archive/hide-home-from-navigation-t8041.

I managed to hide it by adding {% if not page.home %} in navigation.html.twig like this:

TWIG
{% if not page.home %}
    <li class="{{ current_page }}">
        <a href="{{ page.url }}">
            {% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
            {{ page.menu }}
        </a>
    </li>
{% endif %}

This removes the "Home" link from all pages.

I still wonder where to add visibility: false as an alternative solution ... modular.md for 01.home is set to onpage_menu: false, but it doesn't seem to have any effect.

9 years ago

Hi @gravus, to use the visibility option you would add this setting to the page frontmatter of the Markdown page which is your homepage. If you are using the Admin Panel visible is usually a setting on a tab such as 'Options' when editing a page.

For example, let's say your home page was called Blog, and the Markdown file was called 'blog.md', then the frontmatter would be:

TXT
visible: false
👍 3
9 years ago

Hey @paulhibbitts, that worked perfectly, thanks for sharing! To others, here is the setting: 'Pages' > 'Home' > 'Advanced' > set 'Visible' to 'Disabled' and click 'Save'. Like @paulhibbitts write, this will add visible: false to the settings file for the page.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 14 hours ago
Support · by Anna, 3 days ago
2 65 17 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago