web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / How to hide Main Navig...
Power Pages
Answered

How to hide Main Navigation in power pages portal

(0) ShareShare
ReportReport
Posted on by 265

hi,

according to my requirement i need to hide main navigation after signing. after checking some condition, need to display main navigation again. Please help me to do it.

 

thank you

Categories:
I have the same question (0)
  • Verified answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at

    Hi @Erandi ,

    We are bit unclear about you requirement but as per our understandings, you are looking for a how to hide Main Navigation in power pages portal after checking some condition. So, you can follow below steps.


    • Open the Web Template named "Header." You can locate this in the Power Pages Management or Portal Management App.

    • Make a simple adjustment in your Web Template. Utilize Liquid to hide blocks based on conditions related to the user object.
    •
    {% assign defaultlang = settings['LanguageLocale/Code'] | default: 'en-us' %}

    {% assign homeurl = website.adx_partialurl %}

     

    <div
    class='navbar navbar-inverse navbar-static-top'
    role='banner'
    id='navbar'
    style='display: none;'>

    <div
    class='skip-to-content'>

    <a
    href='#mainContent'>{{ resx.Skip_To_Content | default: 'Skip to main content' }}</a>

    </div>

    <div
    class='container'>

    <div
    class='navbar-header'>

    <div
    class='visible-sm-block visible-md-block visible-lg-block visible-xs-block navbar-brand'>

    {% editable snippets 'Mobile Header' type: 'html' %}

    </div>

    <button
    type='button'
    class='navbar-toggle collapsed'
    title='{{ snippets["Header/Toggle Navigation"] | default: resx['Toggle_Navigation']
    | h
    }}' data-toggle='collapse'
    data-target='#navbar'
    aria-expanded='false'
    onclick='setHeight();'>

    <span
    class='sr-only'>{{ snippets['Header/Toggle Navigation'] | default: resx.Toggle_Navigation | h }}</span>

    <span
    class='icon-bar'></span>

    <span
    class='icon-bar'></span>

    <span
    class='icon-bar'></span>

    </button>

    </div>

    {% if user %}

    {% assign primary_nav = weblinks.Default %}

    {% if primary_nav %}

    <nav
    aria-label='{{ resx.Main_Navigation | default: "Main Navigation" }}'
    class='navbar-right menu-bar {% if primary_nav.editable %}xrm-entity xrm-editable-adx_weblinkset{% endif %}'
    data-weblinks-maxdepth='2'>

    <ul
    class='nav navbar-nav weblinks'>

    <!-- Add your navigation links here -->

    <!-- Example: -->

    <li><a
    href="#">Link 1</a></li>

    <li><a
    href="#">Link 2</a></li>

    <!-- End of navigation links -->

    </ul>

    </nav>

    {% endif %}

    {% endif %}

    </div>

    </div>

     

    <!-- Button to show navigation -->

    <button
    id="showNavigationButton"
    onclick="showNavigation()">Show Navigation</button>

     

    {% substitution %}

    <!-- Your substitution code goes here -->

    {% endsubstitution %}

     

    <script>

    function
    showNavigation() {

    // Show the navigation bar

    var navbar
    = document.getElementById('navbar');

    if (navbar) {

    navbar.style.display
    = 'block';

    }

    // Hide the button

    var showNavigationButton
    = document.getElementById('showNavigationButton');

    if (showNavigationButton) {

    showNavigationButton.style.display
    = 'none';

    }

    }

    </script>

     


    NOTE:- Before making any changes to the header, it's advisable to back up your code.


    We've customized the solution based on our understanding. In this setup, the main navigation will only be visible to authenticated users upon button click. You can modify the visibility conditions according to your specific requirements.

    Thanks!

    Inogic Professional Services

    An expert technical extension for your techno-functional business needs

    Power Platform/Dynamics 365 CRM

    Drop an email at crm@inogic.com

    Service:  http://www.inogic.com/services/ 

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • Erandi Profile Picture
    265 on at

    Thank you very much I will go through this @Inogic 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard