Files
LeafWeb/WebCms/Umbraco/PartialViewMacros/Templates/ListChildPagesFromChangeableSource.cshtml
T
2016-11-07 12:56:17 -05:00

33 lines
962 B
Plaintext

@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
Macro to list all child pages under a specific page in the content tree.
How it works:
- Confirm the startNodeId macro parameter has been passed in with a value
- Loop through all child pages
- Display a list of link to those pages, sorted by the value of the propertyAlias
Macro Parameters To Create, for this macro to work:
Alias:startNodeId Name:Select starting page Type:Content Picker
*@
@{ var startNodeId = Model.MacroParameters["startNodeId"]; }
@if (startNodeId != null)
{
@* Get the starting page *@
var startNode = Umbraco.Content(startNodeId);
var selection = startNode.Children.Where("Visible");
if (selection.Any())
{
<ul>
@foreach (var item in selection)
{
<li>
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
}
}