Why are my if/else statements in page.html.twig ignored? in my theme template of page.html.twig (theme is a subtheme of classy core theme), my if statements to render a region or not are completely ignored by twig template engine. The regions (e.g. the first sidebar are always rendered.

Code of my page.html.twig:

  &lt;header role="banner"&gt;
    {{ page.header }}
  &lt;/header&gt;

  {{ page.primary_menu }}
  {{ page.secondary_menu }}

      {% if page.navigation %}
      &lt;nav class="layout-navigation" role="navigation"&gt;
        {{ page.navigation }}
      &lt;/nav&gt;
    {% endif %}

  {{ page.breadcrumb }}

  {% if page.system_messages_area %}

    {{ page.system_messages_area }}

  {% endif %}

  {{ page.highlighted }}

  {{ page.help }}


  &lt;div id="main-wrapper"&gt;
    &lt;main role="main"&gt;
      &lt;a id="main-content" tabindex="-1"&gt;&lt;/a&gt;{# link is in html.html.twig #}

      &lt;div class="layout-content"&gt;
        {{ page.content }}
      &lt;/div&gt;{# /.layout-content #}

      {% if page.sidebar_first %}
        &lt;aside class="layout-sidebar-first sidebar" role="complementary"&gt;
          {{ page.sidebar_first }}
        &lt;/aside&gt;
      {% endif %}

      {% if page.sidebar_second %}
        &lt;aside class="layout-sidebar-second sidebar" role="complementary"&gt;
          {{ page.sidebar_second }}
        &lt;/aside&gt;
      {% endif %}

    &lt;/main&gt;
  &lt;/div&gt;    

  {% if page.footer %}
    &lt;footer role="contentinfo"&gt;
      {{ page.footer }}
    &lt;/footer&gt;
  {% endif %}


Code of my theme.info.yml:

name: mytheme
type: theme
description: Based on classy core base theme.
core: 8.x
# Defines the base theme
base theme: classy
# Defines libraries group in which we can add css/js.
logo: logo.png
libraries:
  - mytheme/global-styling
# Regions
regions:
  header: Header
  navigation: Navigation and Menus
  system_messages_area: Area for system messages 
  highlighted: Featured
  help: Help
  content: Content
  sidebar_first: First sidebar
  sidebar_second: Second sidebar
  footer: Footer


Maybe someone could help me to find the mistake, as far as I can see everything is at it's right place.

Thanks in advance

Best regards phil
I would check, if the page render-array contains the element sidebar_first. You can do this with 

{{ dump( page|keys) }} 

in your page.html.twig (or use devels kint function for that). The |keys filter will prevent you from memory overflow if your page is big.

If this is the case, then your template is ok and you don't have to look at twig, but to search, what else is in the render array and where it could be originated.