Umbraco 6 Razor Nested Menu

Implement a nested menu in umbraco with razor

Posted on Thursday, September 19, 2013


Page Structure:

Menu

Razor Code

Output:

Menu Output

 example html output

<h2><a href="/en/about-us.aspx">About us</a></h2>

<ul class="nav">
<li>
<a href="/en/about-us/section-1.aspx">Section 1</a>
</li>
<li >
<ul>
<li>
<a class="selected" href=
"/en/about-us/section-1/section-1-1.aspx">Section 1-1</a>
</li>
<li >
<ul>
<li>
<a href=
"/en/about-us/section-1/section-1-1/section-1-1-1.aspx">
Section 1-1-1</a>
</li>
</ul>
</li>

<li>
<a href="/en/about-us/section-1/section-1-2.aspx">Section
1-2</a>
</li>

<li>
<a href="/en/about-us/section-1/section-1-3.aspx">Section
1-3</a>
</li>
</ul>
</li>

<li>
<a href="/en/about-us/section-2.aspx">Section 2</a>
</li>

<li>
<a href="/en/about-us/section-3.aspx">Section 3</a>
</li>
</ul>