heres a query for my blog posts (folowing umbraco turtorials with html template)
@{
var selection = Umbraco.Content(Guid.Parse("8d7b4400-0402-4222-9a48-d253d71ec8be"))
.ChildrenOfType("articleItem")
.Where(x => x.IsVisible())
.OrderByDescending(x => x.CreateDate);
}
I whant to make a query that selects only the latest created element to put on top of page as a featured blogpost,
and im nut shure how to render the Image from media picker.
like
You can add the Take parameter to the query so it only pulls the amount of records you desire. In this case you would add ".take(1)" at the end of your current query
Query builder
heres a query for my blog posts (folowing umbraco turtorials with html template) @{ var selection = Umbraco.Content(Guid.Parse("8d7b4400-0402-4222-9a48-d253d71ec8be")) .ChildrenOfType("articleItem") .Where(x => x.IsVisible()) .OrderByDescending(x => x.CreateDate); } I whant to make a query that selects only the latest created element to put on top of page as a featured blogpost, and im nut shure how to render the Image from media picker. like
Thanx in advance :) -Svante
You can add the Take parameter to the query so it only pulls the amount of records you desire. In this case you would add ".take(1)" at the end of your current query
the code would look like this:
is working on a reply...