0

The following GraphQL query returns items based on the Page template:

  search(keyword: "Dream",
    first: 10, 
    language: "en",
    fieldsEqual: [{name:"_templatename", value:"Page" }]
  ) {
    results {
      items {
        name
        id
        language
        item {
          url
        }
      }
    }
  }
}

ATM, Page is the only page template in the solution so the query works fine. There is a need to introduce new (numerous) page types like 'Product Page', 'FAQ', 'Organization' inheriting 'Page' (mainly for the content editor usability to assign proper insert options).

How to extend the query to cover all the pages inheriting Page template?

| improve this question | | | | |
0

Currently there is no OR in the search, you can do a search for each page type, or first do a facetOn: "_templatename" than you know how many items there are for each templateName

But to keep it simple add a CheckBox Field with for example name "IncludeInSearch" default value "1" to all Page template than can include in the search. and use fieldsEqual:[{name:"IncludeInSearch", value:"1" } ] and re index your index.

As a side effect editor have no the option to hide also pages from the search.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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