How to make Main Navigation not originate from Home
I'm trying to make my Navigation not to originate from Home. The reason is because I have three top links and I want each Top links to have its own navigation.
So what I want to do is to somehow originate from the top links I have
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var home = CurrentPage.Site(); }
@if (home.Children.Any())
{
@* Get the first page in the children *@
var naviLevel = home.Children.First().Level;
@* Add in level for a CSS hook *@
<div class="linje"></div>
<ul class="meny level-@naviLevel">
@* For each child page under the home node *@
@foreach (var childPage in home.Children)
{
if (childPage.Children.Any())
{
<li class="dropdown has-child @(childPage.IsAncestorOrSelf(CurrentPage) ? "selected" : null)">
@if (childPage.DocumentTypeAlias == "Huvudmeny")
{
<span>@childPage.Name</span>
@childPages(childPage.Children)
}
else
{
<a href="@childPage.Url" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">@childPage.Name</a>
}
@helper childPages(dynamic pages)
{
@* Ensure that we have a collection of pages *@
if (pages.Any())
{
@* Get the first page in pages and get the level *@
var naviLevel = pages.First().Level;
@* Add in level for a CSS hook *@
<ul class="meny dropdown-menu sublevel level-@(naviLevel)">
@foreach (var page in pages)
{
<li>
<a href="@page.Url">@page.Name</a>
@* if the current page has any children *@
@if (page.Children.Any())
{
@* Call our helper to display the children *@
@childPages(page.Children)
}
</li>
}
</ul>
}
}
</li>
}
else
{
<li class="@(childPage.IsAncestorOrSelf(CurrentPage) ? "selected" : null)">
<a href="@childPage.Url">@childPage.Name</a>
</li>
}
}
</ul>
<div class="linje col-md-12" ></div>
}
How to make Main Navigation not originate from Home
I'm trying to make my Navigation not to originate from Home. The reason is because I have three top links and I want each Top links to have its own navigation.
So what I want to do is to somehow originate from the top links I have
Hi Johan,
Can you show your code of navigation?
Here is the code of my MainNavigation:
Johan,
As I understand Home page is on the same level as another pages, so you can remove it from menu if you restrict it by index or doctype.
How can I restrict it by doctype?
is working on a reply...