Hide navigation from one entry but not others I am looking to hide the main navigation for entries that have the lightswitch 'showMainNavigation' disabled. The problem I am facing is when I disable for one entry, the navigation is hidden for all entries. Here is a sample of the code:

{% set mainEntry = craft.entries.slug(craft.app.request.getSegment(1)).one() %}
{% set menuLogo = mainEntry.menuLogo %}
{% set hideMenu = craft.entries.section('mysection').showMainNavigation('not 1').one() %} 

{% if hideMenu %}
&lt;nav class="navbar navbar-expand-lg main-menu"&gt;
    &lt;div class="standard-wrapper"&gt;
        {% if menuLogo|length %}
        &lt;div class="navbar-brand logo logo-white visible"&gt;&lt;a href="#"&gt;&lt;img src="{{siteUrl}}{{menuLogo.one().getUrl()}}"/&gt;&lt;/a&gt;&lt;/div&gt;
        {% endif %}
    &lt;/div&gt;
&lt;/nav&gt;

{% else %}

&lt;nav class="navbar navbar-expand-lg main-menu"&gt;
    &lt;div class="standard-wrapper"&gt;
        {% if menuLogo|length %}
        &lt;div class="navbar-brand logo logo-white visible"&gt;&lt;a href="#"&gt;&lt;img src="{{siteUrl}}{{menuLogo.one().getUrl()}}"/&gt;&lt;/a&gt;&lt;/div&gt;
        {% endif %}
        &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" onclick="myFunction(this)"&gt;
            &lt;span class="navbar-toggler-icon"&gt;
            &lt;div class="bar1"&gt;&lt;/div&gt;
            &lt;div class="bar2"&gt;&lt;/div&gt;
            &lt;div class="bar3"&gt;&lt;/div&gt;&lt;/span&gt;
        &lt;/button&gt;

        &lt;div class="collapse navbar-collapse float-right menu" id="navbarSupportedContent"&gt;
            &lt;ul class="navbar-nav mr-auto no-list-style"&gt;
                &lt;li class="nav-item active"&gt;list item 1&lt;/li&gt;
                &lt;li class="nav-item active"&gt;list item 2&lt;/li&gt;
            &lt;/ul&gt;
         &lt;/div&gt;
     &lt;/div&gt;
&lt;/nav&gt;
{% endif %}
This line:

{% set hideMenu = craft.entries.section('mysection').showMainNavigation('not 1').one() %} 


will return the first entry that it can find in the section 'mysection' that has showMainNavigation off. So as soon as you disable it for one entry, hideMenu will 'return' true, whichever page you're on.

So to fix this, if mainEntry is your current entry, then replace the line by:

{% set hideMenu = mainEntry.showMainNavigation %}