Search code examples
liferay-themeliferay-7

How to hide navigation menu in pages that are hidden in Navigation Menu in Liferay?


In other words, I want to hide the navigation menu from the other private pages that have checked the option Hide from Navigation Menu in Control Panel.

In my theme, I am showing the navigation menu on private pages only:

<#if layout.isPrivateLayout()>
    <#if has_navigation && is_setup_complete>
        <#include "${full_templates_path}/navigation.ftl" />
    </#if>
</#if>

And I want to further hide it in some of the private pages (the ones that the users open as a hyperlink). They are not part of the navigation menu as I have checked the option Hide from Navigation Menu - but the navigation menu does show up in them.

If there is no direct way of doing this, how can I get the page name and set the Navigation menu to not display in those pages.

I am using Liferay 7 CE GA2 but I believe this is a generic question.


Solution

  • You followed the right track. The only thing missing is the check for Layout.isHidden():

    <#if layout.isPrivateLayout() && !layout.isHidden()>
       <#if has_navigation && is_setup_complete>
          <#include "${full_templates_path}/navigation.ftl" />
       </#if>
    </#if>