Update Umbraco to 7.12.2
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
@using Umbraco.Web
|
||||
@inherits Umbraco.Web.Macros.PartialViewMacroPage
|
||||
|
||||
@{ var selection = CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"); }
|
||||
@* OrderBy() takes the property to sort by and optionally order desc/asc *@
|
||||
@*
|
||||
This snippet makes a list of links to the of children of the current page using an unordered HTML list.
|
||||
|
||||
<ul>
|
||||
@foreach (var item in selection)
|
||||
{
|
||||
<li><a href="@item.Url">@item.Name</a></li>
|
||||
}
|
||||
</ul>
|
||||
How it works:
|
||||
- It uses the Children method to get all child pages
|
||||
- It then uses the OrderByDescending() method, which takes the property to sort. In this case the page's creation date.
|
||||
- It then generates links so the visitor can go to each page
|
||||
*@
|
||||
|
||||
@{ var selection = Model.Content.Children.Where(x => x.IsVisible()).OrderByDescending(x => x.CreateDate).ToArray(); }
|
||||
|
||||
@if (selection.Length > 0)
|
||||
{
|
||||
<ul>
|
||||
@foreach (var item in selection)
|
||||
{
|
||||
<li><a href="@item.Url">@item.Name</a></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user