Skip to main content
edited tags
Link
Rick Pannekoek
  • 21.4k
  • 1
  • 18
  • 30
added more detail in response to PCA queries - highlighted page publishing method
Source Link

I have pages being published using DXA Page Templates and include CPs added to the page directly (again, using standard DXA CTs).

I want to get the Component Presentations from a Page, in the order the editor places them on (with the Pagecontent nodes), in the order the editor places them on the Page (optionally within regions) - ideally in a single GraphQL query.

{
  "data": {
    "page": { "itemId": 730, "title": "XO Home",
      "containerItems": [
        {
  "component": { "itemId": 485 } },
        { "component": { "itemId": 485544 } },
        { "component": { "itemId": 600 } },
        { "component": { "itemId": 868 } }
      ]
...
       "component"    "data": { 
 "itemId": 544 }           "Id": "485-650",
        }      "Namespace": "tcm",
              "ComponentTemplate": {...,
          "component"    "Folder": { 
 "itemId"               "Id": 600"130",
 }               "Title": "Products"
              },
              "Content": {
          "component": { "itemId"    "headline": 868"Content }headline",
        }
      ]
  "introduction": "Content }introduction",
  }
}              "body": {...
{
  page(namespaceId: 1, publicationId: 7, pageId: 730) {
    itemId
    pageTemplate {
      id
    }
    title
    url
    content {
      ... on UntypedContent {
        data
        type
      }
    }
  }
}
...
            {
              "$type": "EmbeddedRegion",
              "components": [
                {
                  "$type": "Link",
                  "id": "tcm:7-868",
                  "title": "2020-09-03_08:20:49-my campaign-Sample Offering""..."
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-485",
                  "title": "LightSolar RI Offering""..."
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-600",
                  "title": "LightSolar CII Offering""..."
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-544",
                  "title": "LightSolar CI Offering""..."
                }
              ],
...

I want to get the Component Presentations from a Page, in the order the editor places them on the Page (optionally within regions) - ideally in a single GraphQL query.

{
  "data": {
    "page": { "itemId": 730, "title": "XO Home",
      "containerItems": [
        {
           "component": { "itemId": 485 }
        },
        {
          "component": { "itemId": 544 }
        },
        {
          "component": { "itemId": 600 }
        },
        {
          "component": { "itemId": 868 }
        }
      ]
    }
  }
}
{
  page(namespaceId: 1, publicationId: 7, pageId: 730) {
    itemId
    pageTemplate {
      id
    }
    title
    url
    content {
      ... on UntypedContent {
        data
        type
      }
    }
  }
}
...
            {
              "$type": "EmbeddedRegion",
              "components": [
                {
                  "$type": "Link",
                  "id": "tcm:7-868",
                  "title": "2020-09-03_08:20:49-my campaign-Sample Offering"
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-485",
                  "title": "LightSolar RI Offering"
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-600",
                  "title": "LightSolar CII Offering"
                },
                {
                  "$type": "Link",
                  "id": "tcm:7-544",
                  "title": "LightSolar CI Offering"
                }
              ],
...

I have pages being published using DXA Page Templates and include CPs added to the page directly (again, using standard DXA CTs).

I want to get the Component Presentations from a Page (with the content nodes), in the order the editor places them on the Page (optionally within regions) - ideally in a single GraphQL query.

{
  "data": {
    "page": { "itemId": 730, "title": "XO Home",
      "containerItems": [
        { "component": { "itemId": 485 } },
        { "component": { "itemId": 544 } },
        { "component": { "itemId": 600 } },
        { "component": { "itemId": 868 } }
      ]
...
           "data": { 
              "Id": "485-650",
              "Namespace": "tcm",
              "ComponentTemplate": {...,
              "Folder": { 
                "Id": "130",
                "Title": "Products"
              },
              "Content": {
                "headline": "Content headline",
                "introduction": "Content introduction",
                "body": {...
{
  page(namespaceId: 1, publicationId: 7, pageId: 730) {
    itemId
    pageTemplate { id }
    title
    url
    content { ... on UntypedContent {
        data
        type
      }
    }
  }
}
...
            {
              "$type": "EmbeddedRegion",
              "components": [
                { "$type": "Link",
                  "id": "tcm:7-868",
                  "title": "..."
                },
                { "$type": "Link",
                  "id": "tcm:7-485",
                  "title": "..."
                },
                { "$type": "Link",
                  "id": "tcm:7-600",
                  "title": "..."
                },
                { "$type": "Link",
                  "id": "tcm:7-544",
                  "title": "..."
                }
              ],
...
added note re this seems to be related to DCPs - but still want to understand the architecture and what can be reuse in a SPA format?
Source Link

UPDATE:

So I'm guessing that the CPs are being returned as they are DCPs... and maybe there's some magic between DXA and the Content Services that means DXA can request the CPs to be populated even when they are DCPs (to avoid multiple requests etc.).

If anyone can share info on this it would be really useful!

UPDATE:

So I'm guessing that the CPs are being returned as they are DCPs... and maybe there's some magic between DXA and the Content Services that means DXA can request the CPs to be populated even when they are DCPs (to avoid multiple requests etc.).

If anyone can share info on this it would be really useful!

Tweeted twitter.com/StackTridion/status/1397613505226977282
Source Link
Loading