<p>I'm an idiot, i can just do:</p>

<pre><code>&lt;ul&gt;
   {% nav page in blah %}
    &lt;li&gt;
         {% if page.level == 1 %}
            &lt;a href="/{{ section.handle }}#{{ page.slug }}"&gt;{{ page.title }}&lt;/a&gt;
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

         {% ifchildren %}
            &lt;ul&gt;
            &lt;li&gt;&lt;a href="/{{ page.slug }}"&gt;{{ page }}&lt;/a&gt;&lt;/li&gt; -- this is dodgy
                {% children %}
            &lt;/ul&gt;
         {% endifchildren %}
    &lt;/li&gt;
    {% endnav %}
 &lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2016-06-11T18:58:16.870Z
2016-06-11T18:58:16.870Z
John
<p>I'm using the nav tag to build a menu which works great, but i just want to repeat the parent menu item over to any sub nav. So if there is a sub nav, at the top of the sub navs links, i want the parent url repeated once.</p>

<p>My current code is this</p>

<pre><code> &lt;ul&gt;
   {% nav page in blah %}
    &lt;li&gt;
         {% if page.level == 1 %}
            &lt;a href="/{{ section.handle }}#{{ page.slug }}"&gt;{{ page.title }}&lt;/a&gt;
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

         {% ifchildren %}
            &lt;ul&gt;
                {% children %}
            &lt;/ul&gt;
         {% endifchildren %}
    &lt;/li&gt;
    {% endnav %}
 &lt;/ul&gt;
</code></pre>

<p>and i'm looking at doing something like (but i would love it to work obviously)</p>

<pre><code> &lt;ul&gt;
   {% nav page in blah %}
    &lt;li&gt;
         {% if page.level == 1 %}
            &lt;a href="/{{ section.handle }}#{{ page.slug }}"&gt;{{ page.title }}&lt;/a&gt;
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

         {% ifchildren %}
            &lt;ul&gt;
            &lt;li&gt;{{ page.parent.getLink() }}&lt;/li&gt; -- this is dodgy
                {% children %}
            &lt;/ul&gt;
         {% endifchildren %}
    &lt;/li&gt;
    {% endnav %}
 &lt;/ul&gt;
</code></pre>

<structure><navigation>
Using the nav tag repeat the parent once in the children
# Using the nav tag repeat the parent once in the children

(Asked by: username_0 on 2016-06-11)

I'm using the nav tag to build a menu which works great, but i just want to repeat the parent menu item over to any sub nav. So if there is a sub nav, at the top of the sub navs links, i want the parent url repeated once.
My current code is this
 
   {% nav page in blah %}
    
         {% if page.level == 1 %}
            {{ page.title }}
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

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

and i'm looking at doing something like (but i would love it to work obviously)
 
   {% nav page in blah %}
    
         {% if page.level == 1 %}
            {{ page.title }}
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

         {% ifchildren %}
            
            {{ page.parent.getLink() }} -- this is dodgy
                {% children %}
            
         {% endifchildren %}
    
    {% endnav %}

**Tags:** structure, navigation


---

## 1 answers

### Answer by username_0 on 2016-06-11. Score: 2

I'm an idiot, i can just do:

   {% nav page in blah %}
    
         {% if page.level == 1 %}
            {{ page.title }}
                {% else %}
                    {{ page.getLink() }}
         {% endif %}

         {% ifchildren %}
            
            {{ page }} -- this is dodgy
                {% children %}
            
         {% endifchildren %}
    
    {% endnav %}


---

