Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rob de Mercado 32 posts 148 karma points
    Mar 12, 2019 @ 16:01
    Rob de Mercado
    0

    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.

    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.

    enter image description here

  • Rhys Hamilton 140 posts 942 karma points
    Mar 12, 2019 @ 17:06
    Rhys Hamilton
    100

    You can use the isDocumentTypeextension method to achieve this.

    The following should work:

    var nodes = Model.Root().Children().Where(x => x.IsDocumentType("councilLandingPage") && x.IsVisible());
    
  • Rob de Mercado 32 posts 148 karma points
    Mar 13, 2019 @ 10:13
    Rob de Mercado
    1

    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.

Please Sign in or register to post replies

Write your reply to:

Draft