list all DescendantsOrSelf("NewsItem") excluding some nodes
Hi I want to list all DescendantsOrSelf("umbNewsItem") but I want to exclude some nodes from the list that has NewsItems
Can I exclude then using the Node Name, I´m trying using where clause but I have no results.
For example I want to list all newsitems excluding the ones in Child 3
All folders has newsitems
Home
-Folder 1
- Int Folder 1
- Child 1
- Child 2
- Child 3
- Child 4
- Int Folder 2
- Child 1
- Child 2
- Child 5
- Child 6
- Folder 2
- Int Folder 1
- Child 5
- Child 6
var homePage = CurrentPage.AncestorsOrSelf(1).First();
var articles = homePage.DescendantsOrSelf("umbNewsItem").Where(XXX).OrderBy("publishDate desc, createDate desc").Take(4);
list all DescendantsOrSelf("NewsItem") excluding some nodes
Hi I want to list all DescendantsOrSelf("umbNewsItem") but I want to exclude some nodes from the list that has NewsItems Can I exclude then using the Node Name, I´m trying using where clause but I have no results.
For example I want to list all newsitems excluding the ones in Child 3 All folders has newsitems
What must I write in XXX ? Thanks.
Hi Pablo,
What you could do is to add a property on your newsitem, of the type true/false data type. The alias of the property should be umbracoNaviHide.
Then you could do this
Then It will only show the items that doesn't have a tick in the umbracoNaviHide.
You can of course name the property what you want, the important thing is the alias of the property that needs to be umbracoNaviHide
Hope this helps, and can be a solution.
/Dennis
Hi Pablo
I'd do what Dennis suggests... but out of curiosity:
would be the sort of syntax you would need to answer your specific question...
ie you use @0, @1, @2 parameters to substitute into your Where condition
regards
Marc
Thanks to both!!! Marc, I was trying your solution but "parent.Name" was what I need. THANKS, I was writting wrong "NodeName". Thanks again!!!
is working on a reply...