I would like to say that it worked, but no :-( I tried both solutions, but still nothing. The alias for the news page is "NewsList" and its childrens alias is "News"
@inherits umbraco.MacroEngines.DynamicNodeContext @{ var newsItems = Model.NodeById(NewsListNodeID); //add the NodeId of NewsList Here var sortedItems = newsItems.Children.OrderBy("createDate descending"); foreach(var page in sortedItems.Where("visible")) { <li><a href="@page.Url" title="@page.Name">@page.Name</a></li> } }
News list on every page
Hi, I am trying to make a news list that will be on every single page, but I am no razor wizard like most of you guys. My site layout looks like this:
Language
--- Front
--- Page 1
--- Page 2
--- Page 3
--- NewsList
--- --- Item 1
--- --- Item 2
--- --- Item 3
This is what I have got so far:
If you need more information, you shall have it!
Thank you :-)
Hi Daniel.
See that NewsList is not a property of "Language" so for getting all news item you should do something like that :
var news = Model.AncestorsOrSelf("Language").Descendants("News-item-alias");
If you want to get the news folder Node and run trow children you could do domething like that :
var news = Model.AncestorsOrSelf("Language").Descendants("News-folder-alias").First();
Hope that help.
Cheers
I would like to say that it worked, but no :-( I tried both solutions, but still nothing. The alias for the news page is "NewsList" and its childrens alias is "News"
Thank you for the quick response! :-)
What do you get?
try this :
Hi Daniel,
Try using the nodeById
This should get you working
//fuji
Thanks gilad, it works! :-) And thank you Fuji for the response :-)
is working on a reply...