Answers.Body: <blockquote>
    <p>But this only outputs the <code>pageContent</code>. I guess because <code>booking</code> is a single section and therefore has no <code>level</code>?</p>
  </blockquote>
  
  <p>In short, yes. It's not super clean but you could fetch everything without worrying about level:</p>
  
  <pre><code>{% set merger = craft.entries.section(['pageContent','booking']).all() %}
  </code></pre>
  
  <p>Then check for <code>level</code> in your loop ('normal' entries return <code>null</code> as a <code>level</code>)</p>
  
  <pre><code>{% for item in merger %}
      {% if item.level is null or item.level == 1 %}
          {{ item.title }}&lt;br&gt;
      {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-02T15:23:30.517Z
Answers.LastActivityDate: 2019-07-02T15:23:30.517Z
Answers.UserDisplayName: Oli
Body: <p>That is written so inefficently:</p>
  
  <pre><code>{% set indexNavi = craft.entries.section('pageContent').level(1).all() %}
  {% set bookingLink = craft.entries.section('booking').all() %}
  
  &lt;ul class="navList"&gt;
    {% for item in indexNavi %}
      &lt;li&gt;
        &lt;a class="btnLink" href="{{ item.url }}"&gt;{{ item.title }}&lt;/a&gt;
      &lt;/li&gt;
    {% endfor %}
    {% for item in bookingLink %}
      &lt;li&gt;
        &lt;a class="btnLink" href="{{ item.url }}"&gt;{{ item.title }}&lt;/a&gt;
      &lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Is there a better way?</p>
  
  <p>I wanted to creat a single variable:</p>
  
  <pre><code>{% set merger = craft.entries.section(['pageContent','booking']).level(1).all() %}
  </code></pre>
  
  <p>But this only outputs the <code>pageContent</code>. I guess because booking is a single section and therefore has no <code>level</code>?</p>
  
Tags: <templating><sections>
Title: Merge a structure and a single section
ThreadText: # Merge a structure and a single section
  
  (Asked by: username_0 on 2019-07-02)
  
  That is written so inefficently:
  
  ```
  {% set indexNavi = craft.entries.section('pageContent').level(1).all() %}
  {% set bookingLink = craft.entries.section('booking').all() %}
  
  <ul class="navList">
    {% for item in indexNavi %}
      <li>
        <a class="btnLink" href="{{ item.url }}">{{ item.title }}</a>
      </li>
    {% endfor %}
    {% for item in bookingLink %}
      <li>
        <a class="btnLink" href="{{ item.url }}">{{ item.title }}</a>
      </li>
    {% endfor %}
  </ul>
  
  ```
  
  Is there a better way?
  
  I wanted to creat a single variable:
  
  ```
  {% set merger = craft.entries.section(['pageContent','booking']).level(1).all() %}
  
  ```
  
  But this only outputs the `pageContent`. I guess because booking is a single section and therefore has no `level`?
  
  **Tags:** templating, sections
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-02. Score: 2 | Accepted answer
  
  > But this only outputs the `pageContent`. I guess because `booking` is a single section and therefore has no `level`?
  
  In short, yes. It's not super clean but you could fetch everything without worrying about level:
  
  ```
  {% set merger = craft.entries.section(['pageContent','booking']).all() %}
  
  ```
  
  Then check for `level` in your loop ('normal' entries return `null` as a `level`)
  
  ```
  {% for item in merger %}
      {% if item.level is null or item.level == 1 %}
          {{ item.title }}<br>
      {% endif %}
  {% endfor %}
  
  ```
  
  
  ---
  
  