Answers.Body: <p>Basically the same as <a href="https://craftcms.stackexchange.com/a/6996/125">Steve suggested</a>, but I first merged the entries' IDs and then use them as a criteria in another <code>craft.entries</code> call:</p>
  
  <pre><code>{% set landing = entry.getAncestors().level(1).first() %}
  
  {% set landingId = landing.id %}
  {% set ancestorIds = landing.getDescendants().ids() %}
  {% set entryIds = [ landingId ]|merge( ancestorIds ) %}
  
  {% set entries = craft.entries.id(entryIds) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:37:56.647Z
Answers.Text: This works. Nice one!
Answers.UserDisplayName: hamishtaplin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:32:05.117Z
Answers.LastActivityDate: 2015-02-05T16:32:05.117Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>Untested, but you should be able to do this by using the <a href="http://twig.sensiolabs.org/doc/filters/merge.html" rel="nofollow">merge filter in Twig</a> to join the two results together.</p>
  
  <p>Get the top level 'landing page' for this section:</p>
  
  <pre><code>{% set landingPage = entry.getAncestors().level(1) %}
  </code></pre>
  
  <p>Get the descendants for this section:</p>
  
  <pre><code>{% set childPages = entry.getAncestors().level(1).getDescendants() %}
  </code></pre>
  
  <p>Merge the two results together:</p>
  
  <pre><code>{% set sectionPages = [ landingPage ]|merge(childPages) %}
  </code></pre>
  
  <p>Now create the navigation for the section using the sectionPages variable:</p>
  
  <pre><code>&lt;nav&gt;
      &lt;ul&gt;
          {% nav page in sectionPages %}
              &lt;li&gt;
                  {{ page.getLink() }}
  
                  {% ifchildren %}
                      &lt;ul&gt;
                          {% children %}
                      &lt;/ul&gt;
                  {% endifchildren %}
              &lt;/li&gt;
          {% endnav %}
      &lt;/ul&gt;
  &lt;/nav&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:36:07.473Z
Answers.Text: Thanks for answering! Merging throws an error "The merge filter only works with arrays or hashes; object and object given."
Answers.UserDisplayName: hamishtaplin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:41:28.983Z
Answers.Text: Ah, OK - I did say it was untested! It looks like you'll need to follow [carlcs's answer](http://craftcms.stackexchange.com/a/6997/153) and get the IDs of the entries first.
Answers.UserDisplayName: Steve Rowling
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:41:56.143Z
Answers.Text: Just seen @carlcs edit to my answer - does that help?
Answers.UserDisplayName: Steve Rowling
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:45:42.927Z
Answers.Text: @Steve should work now, yep. Working with IDs first, allows you to use an ElementCriteriaModel (with pagination etc.), something you can't do with an array of EntryModels. But in this case it's actually not necessary and I like this (more simple) answer better. Performance should be about the same, I think.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-06T08:59:36.307Z
Answers.Text: I also prefer this answer, will mark this one instead.
Answers.UserDisplayName: hamishtaplin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-05T16:19:05.427Z
Answers.LastActivityDate: 2015-02-05T16:39:05.857Z
Answers.LastEditDate: 2015-02-05T16:39:05.857Z
Answers.UserDisplayName: Steve Rowling
Body: <p>There are several questions like this already but none seem to cover my use case. I have a structure that looks something like this:</p>
  
  <pre><code>Landing Page 1
  - Case Studies
  -- Case Study 1
  -- Case Study 2
  -- Case Study 3
  - Sub page
  - Sub page
  Landing Page 2
  - Case Studies
  -- Case Study 1
  -- Case Study 2
  -- Case Study 3
  - Sub page
  - Sub page
  </code></pre>
  
  <p>If I'm in any child of the 'Landing Pages' I want to create a nav (as per <a href="http://buildwithcraft.com/help/structure-nav" rel="nofollow">the docs</a>) but I cant' seem to get all of the pages I need. I can easily get the top level 'landing page': </p>
  
  <pre><code>entry.getAncestors().level(1).first()
  </code></pre>
  
  <p>I can then get the descendants separately:</p>
  
  <pre><code>entry.getAncestors().level(1).first().getDescendants()
  </code></pre>
  
  <p>However, I want a single ElementCriteriaModel with everything from the 'landing page' down in it.</p>
  
  <p>Is this possible?</p>
  
Tags: <entries><navigation>
Title: Building a nav from the top level page of a structure
ThreadText: # Building a nav from the top level page of a structure
  
  (Asked by: username_0 on 2015-02-05)
  
  There are several questions like this already but none seem to cover my use case. I have a structure that looks something like this:
  
  ```
  Landing Page 1
  - Case Studies
  -- Case Study 1
  -- Case Study 2
  -- Case Study 3
  - Sub page
  - Sub page
  Landing Page 2
  - Case Studies
  -- Case Study 1
  -- Case Study 2
  -- Case Study 3
  - Sub page
  - Sub page
  
  ```
  
  If I'm in any child of the 'Landing Pages' I want to create a nav (as per [the docs](http://buildwithcraft.com/help/structure-nav)) but I cant' seem to get all of the pages I need. I can easily get the top level 'landing page':
  
  ```
  entry.getAncestors().level(1).first()
  
  ```
  
  I can then get the descendants separately:
  
  ```
  entry.getAncestors().level(1).first().getDescendants()
  
  ```
  
  However, I want a single ElementCriteriaModel with everything from the 'landing page' down in it.
  
  Is this possible?
  
  **Tags:** entries, navigation
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-02-05. Score: 4 | Accepted answer
  
  Untested, but you should be able to do this by using the [merge filter in Twig](http://twig.sensiolabs.org/doc/filters/merge.html) to join the two results together.
  
  Get the top level 'landing page' for this section:
  
  ```
  {% set landingPage = entry.getAncestors().level(1) %}
  
  ```
  
  Get the descendants for this section:
  
  ```
  {% set childPages = entry.getAncestors().level(1).getDescendants() %}
  
  ```
  
  Merge the two results together:
  
  ```
  {% set sectionPages = [ landingPage ]|merge(childPages) %}
  
  ```
  
  Now create the navigation for the section using the sectionPages variable:
  
  ```
  <nav>
      <ul>
          {% nav page in sectionPages %}
              <li>
                  {{ page.getLink() }}
  
                  {% ifchildren %}
                      <ul>
                          {% children %}
                      </ul>
                  {% endifchildren %}
              </li>
          {% endnav %}
      </ul>
  </nav>
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for answering! Merging throws an error "The merge filter only works with arrays or hashes; object and object given."  
  > **username_2**: Ah, OK - I did say it was untested! It looks like you'll need to follow [username_1's answer](http://craftcms.stackexchange.com/a/6997/153) and get the IDs of the entries first.  
  > **username_2**: Just seen @username_1 edit to my answer - does that help?  
  > **username_1**: @username_2 should work now, yep. Working with IDs first, allows you to use an ElementCriteriaModel (with pagination etc.), something you can't do with an array of EntryModels. But in this case it's actually not necessary and I like this (more simple) answer better. Performance should be about the same, I think.  
  > **username_0**: I also prefer this answer, will mark this one instead.  
  
  ---
  
  ### Answer by username_1 on 2015-02-05. Score: 4
  
  Basically the same as [username_2 suggested](https://craftcms.stackexchange.com/a/6996/125), but I first merged the entries' IDs and then use them as a criteria in another `craft.entries` call:
  
  ```
  {% set landing = entry.getAncestors().level(1).first() %}
  
  {% set landingId = landing.id %}
  {% set ancestorIds = landing.getDescendants().ids() %}
  {% set entryIds = [ landingId ]|merge( ancestorIds ) %}
  
  {% set entries = craft.entries.id(entryIds) %}
  
  ```
  
  > **Comments:**
  > **username_0**: This works. Nice one!  
  
  ---
  
  