Follow this step.
Step 1: Cross-Origin Resource Sharing (CORS)
To enable CMS Connect to access external content, you need to configure Cross-Origin Resource Sharing (CORS). Follow these steps:
-
- In the Quick Find Box, search for “CORS” and click on the “New” button.
- Enter the URL of your community domain.
- Add this domain to the list of trusted hosts in the CORS header within your CMS system.
Step 2: Establishing CMS Connection
To establish a connection between your WordPress site and your Community, follow these steps:
-
- Ensure that you have an active and enabled Community. If you haven’t created one yet, please create a community first.
- In the Community Workspace, navigate to the Content Management section.
- Within the Content Management section, locate and select CMS Connect.
- Click on the “New” button located in the upper right corner to initiate the connection setup process.
Connection Details:
To configure the connection, provide the following information:
-
- Enter a descriptive name for the connection.
- Set the CMS Source to “WordPress”.
- Choose the Connection Type as “Public”.
- Specify the Server URL as the domain URL of your WordPress site.
In the JSON section of the connection settings, you will need to provide specific details for individual blog if you’re looking to retrieve a list of blogs, you should provide the necessary information in the “Content List” field.
Both sections require the following key information:
-
- Content Name: This name will be referenced in Step 2 of the process.
- Path: The Path refers to the REST API callout made to your WordPress site, which returns the response in JSON format.
For more detailed information on the REST API, please consult the Rest API Handbook.
Here are the examples of paths for content lists:
For a content list: Example path:
wp-json/wp/v2/posts?number={itemsPerPage}&page={pageNumber}
add this path after your domain url and get the json so it will help for Json node.
wp-json/wp/v2/posts
Step 3: Add CMS Connect Component on Community Page
The next step is to add the CMS Connect Component in the Community page for the blog posts to display on.
-
- Go to the Community Builder.
- Create or Open an existing Community page, add the CMS Connect (JSON) component in the Content area.
- In Properties section,
-
- CMS Source: select the CMS Source we created
- JSON Content: Blog List
- Component Path: LEAVE THIS BLANK
- Content List Layout: Grid
- Items Per Page: This is totally up to you, but I go with 6 as the default
- Columns: Again, totally up to you, but I go with 3 as the default
- Content list Item Layout: Card
- Title @title/rendered
- Author @author_info/name
- Published On @date
- Body @content/rendered
- Featured Image @yoast_head_json/og_image/0/url
- Link Text: Read More
- Type: External URL (to link it WordPress site blog URL)
- Page: Select the page you created in Step 3
- URL @link
Step 4: Save the properties and publish the community.
Note: All site has a differant node so you need to check that Node using this path ‘wp-json/wp/v2/posts’.
Useful links for this blog.
https://help.salesforce.com/s/articleView?id=sf.rss_cms_connect_json.htm&type=5
https://developer.salesforce.com/docs/platform/cms/guide/cms-connect-json-expressions.html
Hello just wanted to give you a quick heads up. The text in your article seem to be running off the screen in Safari. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let you know. The style and design look great though! Hope you get the issue solved soon. Many thanks
I genuinely enjoy studying on this web site, it has got excellent articles.