<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>

CC BY-SA 4.0
2019-07-02T15:23:30.517Z
2019-07-02T15:23:30.517Z
Oli
<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>

<templating><sections>
Merge a structure and a single section
# 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() %}


  {% for item in indexNavi %}
    
      {{ item.title }}
    
  {% endfor %}
  {% for item in bookingLink %}
    
      {{ item.title }}
    
  {% endfor %}


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 }}
    {% endif %}
{% endfor %}


---

