<p>You could use the <code>children</code> tag:</p>

<pre><code>{% set entries = craft.entries.section('products') %}
&lt;ul&gt;
    &lt;li&gt;
        &lt;a href="/products" class="app-nav__primary"&gt;Products&lt;/a&gt;
        &lt;ul class="app-nav__secondary"&gt;
            {% nav entry in entries %}
                &lt;li&gt;
                    &lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
                    {% ifchildren %}
                        &lt;ul&gt;
                            {% children %}
                        &lt;/ul&gt;
                    {% endifchildren %}
                &lt;/li&gt;
            {% endnav %}
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2015-12-18T02:37:01.943Z
2015-12-18T02:37:01.943Z
JMP
<p>I'm new to Craft CMS. I have the following single level navigation code:</p>



<pre class="lang-html prettyprint-override"><code>&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="/products" class="app-nav__primary"&gt;Products&lt;/a&gt;
    &lt;ul class="app-nav__secondary"&gt;
      {% for entry in craft.entries.section('products') %}
      &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
      &lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</code></pre>



<p>How would i adjust this to show a second level navigation in within the parent li? I'm looking for something like this:</p>



<pre class="lang-html prettyprint-override"><code>&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="/products" class="app-nav__primary"&gt;Products&lt;/a&gt;
    &lt;ul class="app-nav__secondary"&gt;
      {% for entry in craft.entries.section('products') %}
      &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
        if (child) { '
          &lt;li&gt;&lt;a href="child.link"&gt;child.title&lt;/a&gt;
        }
        &lt;/li&gt;
        {% endfor %}
    &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</code></pre>



<entries><navigation>
Simple nested navigation
# Simple nested navigation

(Asked by: username_0 on 2015-12-18)

I'm new to Craft CMS. I have the following single level navigation code:

  
    Products
    
      {% for entry in craft.entries.section('products') %}
      {{ entry.title }}
      
      {% endfor %}
    
  


How would i adjust this to show a second level navigation in within the parent li? I'm looking for something like this:

  
    Products
    
      {% for entry in craft.entries.section('products') %}
      {{ entry.title }}
        if (child) { '
          child.title
        }
        
        {% endfor %}

**Tags:** entries, navigation


---

## 1 answers

### Answer by username_1 on 2015-12-18. Score: 3

You could use the children tag:
{% set entries = craft.entries.section('products') %}

    
        Products
        
            {% nav entry in entries %}
                
                    {{ entry.title }}
                    {% ifchildren %}
                        
                            {% children %}
                        
                    {% endifchildren %}
                
            {% endnav %}


---

