So I have a structure with a few entries and a single. I want to list out the first level of the structure, plus the single. Then somewhere else, list out the second level.
I've tried the following:
{% set myPages = craft.entries.section('structureName')|merge(craft.entries.section('singleName')) %}
<nav>
{% nav entry in myPages.level(1) %}
{{ entry.title }}
{% endnav %}
<nav>
<aside>
{% for entry in myPages.level(2) %}
{{ entry.title }}
{% endfor %}
<aside>
Which returns this error:
"Array to string conversion"
When I remove the .level(X)
function it will return all the entries, on all levels; including the single.
For the purposes of making my problem more understandable, I've simplified my above example. I know I could just add the single entry directly into the <nav>
. But I'm curious about ways to add to a entries section object without losing the ability to query levels.
So, in the same way I can exclude entries, is there a way to include an entry from a different section without relying on Twigs merge filter?
level(1).first()
? – Simon Müller Oct 12 '16 at 15:39