Skip to main content
edited body
Source Link
Julius A
  • 752
  • 5
  • 19

Without a sample query reference to tailor my answer, I think what you could leverage here are query fragments to help with multiple templates.

For example:

fragment itemDetails on Item {
  id
  name
  children{
    children(includeTemplateIDs:"{GUID}"{
      id
      name
      someotherfield
    }
  }
}

You can then leverage the templatefragment on your query

query GetPageContent($datasource: String!, $contextItem: String!) {
  datasource(value: $datasource) {
    ...itemDetails
 }
 contextItem(value: $contextItem) {
    ...itemDetails
 }

Ps: Please validate this syntax, just guiding on the approach here

Without a sample query reference to tailor my answer, I think what you could leverage here are query fragments to help with multiple templates.

For example:

fragment itemDetails on Item {
  id
  name
  children{
    children(includeTemplateIDs:"{GUID}"{
      id
      name
      someotherfield
    }
  }
}

You can then leverage the template on your query

query GetPageContent($datasource: String!, $contextItem: String!) {
  datasource(value: $datasource) {
    ...itemDetails
 }
 contextItem(value: $contextItem) {
    ...itemDetails
 }

Ps: Please validate this syntax, just guiding on the approach here

Without a sample query reference to tailor my answer, I think what you could leverage here are query fragments to help with multiple templates.

For example:

fragment itemDetails on Item {
  id
  name
  children{
    children(includeTemplateIDs:"{GUID}"{
      id
      name
      someotherfield
    }
  }
}

You can then leverage the fragment on your query

query GetPageContent($datasource: String!, $contextItem: String!) {
  datasource(value: $datasource) {
    ...itemDetails
 }
 contextItem(value: $contextItem) {
    ...itemDetails
 }

Ps: Please validate this syntax, just guiding on the approach here

Source Link
Julius A
  • 752
  • 5
  • 19

Without a sample query reference to tailor my answer, I think what you could leverage here are query fragments to help with multiple templates.

For example:

fragment itemDetails on Item {
  id
  name
  children{
    children(includeTemplateIDs:"{GUID}"{
      id
      name
      someotherfield
    }
  }
}

You can then leverage the template on your query

query GetPageContent($datasource: String!, $contextItem: String!) {
  datasource(value: $datasource) {
    ...itemDetails
 }
 contextItem(value: $contextItem) {
    ...itemDetails
 }

Ps: Please validate this syntax, just guiding on the approach here