Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
var articles = CurrentPage.AncestorOrSelf(1) .Descendants("GeneralArticle") .Where("Visible") .OrderBy("CreateDate desc") .Take(4) ;
Descendants doesn't allow for multiple values here. How can I get a list of pages for multiple content types?
found another thread that answers it...
var articles = CurrentPage.AncestorOrSelf(1) .Descendants() .Where("NodeTypeAlias == @0 || NodeTypeAlias == @1", "GeneralArticle", "ProjectArticle") .Where("Visible") .OrderBy("CreateDate desc") .Take(4) ;
Hi Matt,
If you are using Umbraco 7 as if I remember you need to use DocumeentTypeAlias instead of NodeTypeAlias. So the code would look like this:
var articles = CurrentPage.AncestorOrSelf(1) .Descendants() .Where("DocumentTypeAlias == @0 || DocumentTypeAlias == @1", "GeneralArticle", "ProjectArticle") .Where("Visible") .OrderBy("CreateDate desc") .Take(4) ;
Hope this helps,
/Dennis
Hi Dennis,
I am using umbraco 7.
NodeTypeAlias appears to work, what's the difference between the two?
Thanks
Don´t think there are any different and if it works for you with NodeTypeAlias, then it´s perfect. I was helping Claus with the same and he need to use the DocumentTypeAlias.
Try to see this post. https://our.umbraco.org/forum/developers/razor/63939-Listing-nodes-of-multiple-doc-types
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Get pages for multiple template types
Descendants doesn't allow for multiple values here. How can I get a list of pages for multiple content types?
found another thread that answers it...
Hi Matt,
If you are using Umbraco 7 as if I remember you need to use DocumeentTypeAlias instead of NodeTypeAlias. So the code would look like this:
Hope this helps,
/Dennis
Hi Dennis,
I am using umbraco 7.
NodeTypeAlias appears to work, what's the difference between the two?
Thanks
Hi Matt,
Don´t think there are any different and if it works for you with NodeTypeAlias, then it´s perfect. I was helping Claus with the same and he need to use the DocumentTypeAlias.
Try to see this post. https://our.umbraco.org/forum/developers/razor/63939-Listing-nodes-of-multiple-doc-types
/Dennis
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.