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

Announcements

News and Announcements icon
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,291 Moderator 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 48

#2
Valantis Profile Picture

Valantis 24

#2
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard