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.
You just need to remove the first item from the list.
@{
var topStories = Umbraco.Content(1052).Descendants().Where("Visible").Where("isFeatured == true").OrderBy("CreateDate desc").Take(5);
topStories.RemoveAt(0); // Remove the first item
}
Thanks again. In case anyone googling and wondering about the same, I just paste my code which actually ended up with another way of solving the issue of presenting the five latest articles updated and marked with the isFeatured property in Bootstrap 4.
Get properties of specific items in collection
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.
You just need to remove the first item from the list.
Thanks a lot, but how do i get the properties from the first element? Or if I for example want the properties from the 3rd element?
In order to get a specific element you have to change the second line of code and write it the right way.
Before you try to get the elements you have to make sure that they exist. So in order to use the ThirdItem you have to make a check like this:
Thanks again. In case anyone googling and wondering about the same, I just paste my code which actually ended up with another way of solving the issue of presenting the five latest articles updated and marked with the isFeatured property in Bootstrap 4.
and the css:
is working on a reply...