Add WebCms
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
@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 *@
|
||||
<ul class="level-@naviLevel">
|
||||
@* For each child page where the property umbracoNaviHide is not True *@
|
||||
@foreach (var item in selection)
|
||||
{
|
||||
<li>
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@* 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)
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
|
||||
@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 *@
|
||||
<ul class="level-@(naviLevel)">
|
||||
@foreach (var item in selection.Where("Visible"))
|
||||
{
|
||||
<li>
|
||||
<a href="@item.Url">@item.Name</a>
|
||||
|
||||
@* 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)
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user