1

I have been successfully using GraphQL to filter on items assigned to a specific template.

Is it possible to do the same with items of a certain PageType?

1
  • 1
    What do you mean with PageType? Jul 3, 2019 at 7:50

1 Answer 1

3

There is an includeTemplateIDs filtering option on children:

topItem: item(path: $datasource) {      
     children(includeTemplateIDs: "{C6F6A81A-F9C9-45D8-AF4E-3E818C470F53}") {
       name
       url
       ... on CustomTemplate  { 
         customField { value }
       }
     }
}
3
  • This is very useful.. just wondering where you found this reference? Is there some hidden JSS GraphQL documentation somewhere that I'm not aware of? Otherwise, how would you specify more than 1 template ID to filter children on?
    – Jeeby
    Sep 25, 2019 at 6:59
  • @Jeeby I found it in graphQL intellisense: open GraphQL browser on rendering (screencast.com/t/OgjG8VcxQGq), then write there "children" in query, mouse over it (screencast.com/t/6ipQRf8JF) and explore on the side menu all the options (screencast.com/t/9V2F42a5CwbK) However, I wasn't able to make it work for more than 1 id, despite it should be a simple array - but I didn't go further in troubleshooting, maybe it just works :) Sep 26, 2019 at 8:18
  • Ah that's handy, thanks for that. Yeah I tried a few things to get more than 1 ID to work, it wouldn't. :(
    – Jeeby
    Sep 27, 2019 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.