2

How to include multiple templates in GraphQL?

When I give something like below doesn't work.

children(includeTemplateIDs: "{614C6C64-AD35-440E-9668-DF39D8A18CCG},{B094FD0E-D349-46C0-B829-GBB37E8AB379}") 

2 Answers 2

1

I have tried the below format it works fine for me and most importantly it should be at the same level.

children(includeTemplateIDs: ["{614C6C64-AD35-440E-9668-DF39D8A18CCG}","{B094FD0E-D349-46C0-B829-GBB37E8AB379}"])

enter image description here

If you want inner child, you should add children query at the next level.

1
  • Thanks Gayathri. Let me try this in few cases then will confirm.
    – S.Kazmi
    Commented Nov 26, 2021 at 19:03
1

Getting multiple data source items data.

query ContentCardQuery($datasource: String!) {
  datasource: item(path: $datasource, language: "en") {
    name
    newsItems: children(
      includeTemplateIDs: ["{B5D116DE-BFE8-4A06-A3FE-90C84320ECCB}"]
    ) {
      name
      ... on RelatedItems {
        title {
          value
        }
        subtitle {
          value
        }
      }
    }
    blogItems: children(
      includeTemplateIDs: ["{02CDBE64-254B-424B-90C3-E74FDBA02572}"]
    ) {
      name
      ... on SubRelatedItems {
        title {
          value
        }
        subtitle {
          value
        }
      }
    }
  }
}


enter image description here

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.