I am using a partial below to create the main navigation
<!-- Nav -->
@* If the Url of the current page is "/" then we want to add the class "current_page_item" *@
@* Otherwise, we set the class to null, that way it will not even be added to the
I have a parent menu "services" with child/sub menus "pavers", "tiles" etc. the parent menu services links to the service page. However there is nothing on this page so I would like to disable the link to the services page, /services/.
the cruical line for you is
child.DocumentTypeAlias == "redirect"
where you can put whatever flag you want, maybe some property from that document eg:
x.GetPropertyValue
Thanks Asembli. I am new to Umbraco so this is all new to me.
I tried this but got an error
Line 28: IEnumerable<IPublishedContent> children = parent.Children(x => x.IsVisible() && !A8.Common.VerifyTrue(x.GetPropertyValue<bool>("seoHideInMenu")));
disable parent nav link
I am using a partial below to create the main navigation
@* If the Url of the current page is "/" then we want to add the class "current_page_item" *@ @* Otherwise, we set the class to null, that way it will not even be added to the- element *@
-
Home
@foreach (var item in menuItems)
{
var childrenItems = item.Children.Where("UmbracoNaviHide == false");
-
@item.Name
@createSubmenu(childrenItems, item.Id)
}
@helper createSubmenu(IEnumerable
@foreach (var node in nodes) { var childrenItems = node.Children.Where("UmbracoNaviHide == false");-
@node.Name
@createSubmenu(childrenItems, node.Id)
}
} }I have a parent menu "services" with child/sub menus "pavers", "tiles" etc. the parent menu services links to the service page. However there is nothing on this page so I would like to disable the link to the services page, /services/.
How do i do that?
Hi, you can do like this:
the cruical line for you is child.DocumentTypeAlias == "redirect" where you can put whatever flag you want, maybe some property from that document eg: x.GetPropertyValue
Best regards,
/Asembli
Thanks Asembli. I am new to Umbraco so this is all new to me.
I tried this but got an error
I used
I am using the nav in a partial.
what is the error?
is working on a reply...