@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@*
This snippet creates links for every single page (no matter how deep) below
the page currently being viewed by the website visitor, displayed as nested unordered html lists.
*@
@{ var selection = CurrentPage.Children.Where("Visible"); }
@* Ensure that the Current Page has children *@
@if (selection.Any())
{
@* Get the first page in the children, where the property umbracoNaviHide is not True *@
var naviLevel = CurrentPage.FirstChild().Where("Visible").Level;
@* Add in level for a CSS hook *@
@* For each child page where the property umbracoNaviHide is not True *@
@foreach (var item in selection)
{
-
@item.Name
@* if this child page has any children, where the property umbracoNaviHide is not True *@
@if (item.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(item.Children)
}
}
}
@helper childPages(dynamic selection)
{
@* Ensure that we have a collection of pages *@
if (selection.Any())
{
@* Get the first page in pages and get the level *@
var naviLevel = selection.First().Level;
@* Add in level for a CSS hook *@
@foreach (var item in selection.Where("Visible"))
{
-
@item.Name
@* if the this page has any children, where the property umbracoNaviHide is not True *@
@if (item.Children.Where("Visible").Any())
{
@* Call our helper to display the children *@
@childPages(item.Children)
}
}
}
}