<p>This is the corrected Twig code. I simply added <code>{{ entry.title }}</code> as an <code>&lt;li&gt;</code> item. This nav appears only on the page that I needed <code>entry.title</code> displaying.</p>

<pre><code>{% set navList = (entry.level == 2) ? entry : entry.getAncestors().level(2).first()  %}

{% if navList.hasDescendants %}

    &lt;ul&gt;
        {% set nav =  navList.getDescendants()  %}
        &lt;li&gt;{{ entry.title }}&lt;/li&gt;
        {% nav page in nav  %}
            {% if page.id != entry.id %}
                &lt;li&gt;{{ page.getLink() }}&lt;/li&gt;
            {% else %}
                &lt;li&gt;{{page}}&lt;/li&gt;
            {% endif %}
        {% ifchildren %}
            &lt;ul&gt;
                {% children %}
            &lt;/ul&gt;
        {% endifchildren %}
        {% endnav %}
    &lt;/ul&gt;

{% endif %}
</code></pre>

CC BY-SA 3.0
2017-10-03T08:55:47.877Z
2017-10-03T23:32:57.650Z
2017-10-03T23:32:57.650Z
Steve Davies
<p>I am trying to display a list of entries.  Specifically the parent entry and it's children's entry.</p>

<p>I started off using this:</p>

<pre><code>{% nav page in craft.entries.section('forms').isChildOf.slug('applicant-form') %}

    &lt;li&gt;
        {{ page.getLink() }}

        {% ifchildren %}
            &lt;ul&gt;{% children %}&lt;/ul&gt;
        {% endifchildren %}
    &lt;/li&gt;

{% endnav %}
</code></pre>

<p>But this only displays the Parent.</p>

<p>I found this solution on Stack here, and all the children display but not the parent.  I also wonder if this is the best solution to display the children as it seems a bit more lines than what is in the Craft docs.</p>

<p>Many thanks.</p>

<pre><code>{% set topLevel = (entry.level == 1) ? entry : entry.getAncestors().level(1).first()  %}

{% if topLevel.hasDescendants %}

    &lt;ul&gt;
        {% set nav =  topLevel.getDescendants()  %}

        {% nav page in nav  %}
            {% if page.id != entry.id %}
                &lt;li&gt;{{ page.getLink() }}&lt;/li&gt;
            {%else%}
                &lt;li&gt;{{page}}&lt;/li&gt;
            {%endif%}

        {% ifchildren %}
            &lt;ul&gt;
                {% children %}
            &lt;/ul&gt;
        {% endifchildren %}

        {% endnav %}

    &lt;/ul&gt;

{% endif %}
</code></pre>

CC BY-SA 3.0
2017-10-02T14:26:52.577Z
I think I have managed to fix this, to include the missing Parent I just add in the in  {{ entry.title }}
Steve Davies
CC BY-SA 3.0
2017-10-02T18:06:32.330Z
Would you mind adding what worked for you as an official answer? Might end up helping someone in the future! :)
Brad Bell
CC BY-SA 3.0
2017-10-03T08:56:23.507Z
Hi @BradBell, that's done - had to wait to answer my own question.
Steve Davies
<children><parents><craft.entries>
List both parent entry and its child entry
# List both parent entry and its child entry

(Asked by: username_0 on 2017-10-02)

I am trying to display a list of entries.  Specifically the parent entry and it's children's entry.
I started off using this:
{% nav page in craft.entries.section('forms').isChildOf.slug('applicant-form') %}

    
        {{ page.getLink() }}

        {% ifchildren %}
            {% children %}
        {% endifchildren %}
    

{% endnav %}

But this only displays the Parent.
I found this solution on Stack here, and all the children display but not the parent.  I also wonder if this is the best solution to display the children as it seems a bit more lines than what is in the Craft docs.
Many thanks.
{% set topLevel = (entry.level == 1) ? entry : entry.getAncestors().level(1).first()  %}

{% if topLevel.hasDescendants %}

    
        {% set nav =  topLevel.getDescendants()  %}

        {% nav page in nav  %}
            {% if page.id != entry.id %}
                {{ page.getLink() }}
            {%else%}
                {{page}}
            {%endif%}

        {% ifchildren %}
            
                {% children %}
            
        {% endifchildren %}

        {% endnav %}

    

{% endif %}

**Tags:** children, parents, craft.entries
> **Comments:**
> **username_0**: I think I have managed to fix this, to include the missing Parent I just add in the in  {{ entry.title }}  
> **username_1**: Would you mind adding what worked for you as an official answer? Might end up helping someone in the future! :)  
> **username_0**: Hi @BradBell, that's done - had to wait to answer my own question.  

---

## 1 answers

### Answer by username_0 on 2017-10-03. Score: 1

This is the corrected Twig code. I simply added {{ entry.title }} as an  item. This nav appears only on the page that I needed entry.title displaying.
{% set navList = (entry.level == 2) ? entry : entry.getAncestors().level(2).first()  %}

{% if navList.hasDescendants %}

    
        {% set nav =  navList.getDescendants()  %}
        {{ entry.title }}
        {% nav page in nav  %}
            {% if page.id != entry.id %}
                {{ page.getLink() }}
            {% else %}
                {{page}}
            {% endif %}
        {% ifchildren %}
            
                {% children %}
            
        {% endifchildren %}
        {% endnav %}
    

{% endif %}


---

