getContent

Retrieves published content from an enhanced CMS workspace or non-enhanced CMS workspace for an enhanced LWR site in Experience Cloud. This wire adapter can also retrieve published content from a non-enhanced CMS workspace for a non-enhanced LWR site.

To get Salesforce CMS content from an enhanced or non-enhanced CMS workspace for an Aura site, use the lightning/cmsDeliveryApi module’s listContent wire adapter instead.

Note

Syntax 

1import { LightningElement, api, wire } from "lwc";
2import { getContent } from "experience/cmsDeliveryApi";
3import siteId from "@salesforce/site/Id";
4
5export default class GetContentCmsDeliveryApiV2 extends LightningElement {
6  @api contentKey;
7
8  data;
9
10  @wire(getContent, { channelOrSiteId: siteId, contentKeyOrId: "$contentKey" })
11  onGetContent(result) {
12    if (result.data) {
13      this.data = result.data;
14    }
15  }
16}

User Interface API Resource 

With channelId parameter:

1GET /connect/cms/delivery/channels/${channelId}/contents/${contentKeyOrId}

With siteId parameter:

1GET /connect/sites/${siteId}/cms/delivery/contents/${contentKeyOrId}

getContent uses this CMS Delivery Content Resource.

Parameters 

Parameter NameTypeDescriptionRequired?
channelOrSiteIdStringThe ID for the enhanced LWR site on which you want to use CMS content.Yes
contentKeyOrIdStringThe content key or content ID for the CMS content that you want to use on your enhanced LWR site.Yes

Returns 

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.