To get the children of a particular document type the following will work ..but you willhave to replace Textpages with the parent document type alias of area you wish to collect ie Blog
@{
//Get the rootnode of the website var siteRoot = Model.AncestorOrSelf(1); //From that node on look at all of it's descendants and find the ones with nodetype blog or news
var updates = siteRoot.Descendants().Where("NodeTypeAlias == \"BlogPost\" || NodeTypeAlias == \"NewsItem\"").OrderBy("CreateDate");
}
//List your nodes
@foreach(var item in updates)
{
@item.Name<br />
}
Second level order by
Hi im new to Umbraco and must say I LOVE IT, I just have a newbie question when working with razor
My site is set up like this:
Home
About
Media
Blog
-a blogentry
News
-a newsentry
Say I want to get all blog and news items and order them by createDate.
Thanks!
To get the children of a particular document type the following will work ..but you willhave to replace Textpages with the parent document type alias of area you wish to collect ie Blog
<ul>
@foreach (var item in @Model.Textpages.Where("Visible").OrderBy("createDate"))
{
<li><a href="@item.Url">@item.Name</a></li>
}
</ul>
Or are you asking to collect and order both news and blog item in the same list ?
yes i want both to be listed and in the same feed
You can do it like so:
is working on a reply...