In Umbraco 7.4.1 I want to have a razor script taking 5 of the latest articles marked with the IsFeatured property and make Bootstrap 4 cards. However I want some of them to be bigger, and need to place them manually. I was thinking something like the code below, however I cannot findout how to get the properties for the first item, and then skip the first items and do a foreach on the rest.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var topStories = Umbraco.Content(1052).Descendants().Where("Visible").Where("isFeatured == true").OrderBy("CreateDate desc").Take(5);
var TopItem = topstories.Items.Item(0);
}
<div class="row">
<div class="col-xs-12">
<div class="col-xs-6">
<div class="card">
<div class="card-block">
<h4 class="card-title">@TopItem.pageTitle</h4>
<p class="card-text small">@TopItem.pageSnippet</p>
<p class="card-text"><a href="@TopItem.Url">Les mer</a></p>
</div>
</div>
</div>
<div class="card-group">
@foreach(var item in topStories){
<div class="card">
<div class="card-block">
<h4 class="card-title">@item.pageTitle</h4>
<p class="card-text small">@item.pageSnippet</p>
<p class="card-text"><a href="@item.Url">Les mer</a></p>
</div>
</div>
}
</div>
</div>
</div>
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/75625-get-properties-of-specific-items-in-collection