I'm trying to get a collection of nodes of a specific content type, but no matter what type I select it lists ALL content for all types. Here is my code.
var nodes = Model.Root().Children("councilLandingPage").Where(x => x.IsVisible());
Even the template Query builder returns too many items. In the attached screen shot only the top five items should be listed. The other two are different content types.
Spot on solution thanks Rhys. Still a fundamental problem in U8 though. Hope they get these problems sorted quick I'm hoping to migrate more systems over the coming months.
Unable to get nodes by content type
I'm trying to get a collection of nodes of a specific content type, but no matter what type I select it lists ALL content for all types. Here is my code.
Even the template Query builder returns too many items. In the attached screen shot only the top five items should be listed. The other two are different content types.
You can use the
isDocumentType
extension method to achieve this.The following should work:
Spot on solution thanks Rhys. Still a fundamental problem in U8 though. Hope they get these problems sorted quick I'm hoping to migrate more systems over the coming months.
is working on a reply...