Reputation: 3392
I am using Umbraco 7 on our guinea pigs' website. The blog overview page is sorting the oldest first and you have to scroll down to get newer ones, which is not what I (or anyone for that matter) want. Code is:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
}
<div role="content">
<section class="light blogarchive equalizer">
<div class="container">
<div class="row">
@foreach(var post in CurrentPage.Children)
{
<div class="col-sm-6">
<div class="content equal">
<a href="@post.Url">
<div class="date">@post.CreateDate.ToLongDateString()</div>
<h2>@post.Name</h2>
<p>@Umbraco.Truncate(post.Introduction, 240, true)</p>
</a>
</div>
</div>
}
</div>
</div>
</section>
</div>
But I know Umbraco has their own flavor of everything under the sun .NET in their code so, I had tried LINQing in there to no avail.
I bet it's something so simple. I just want to sort by the CreatedDate or PublishDate (not sure what's available) descending
Upvotes: 0
Views: 690
Reputation: 3392
got it:
@foreach(var post in CurrentPage.Children.OrderBy("CreateDate desc"))
Like I said, Umbraco has it's own flavor of everything, even LINQ-ish...
Upvotes: 1