Skip to main content

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:

    1. In the Quick Find Box, search for “CORS” and click on the “New” button.
    2. Enter the URL of your community domain.
    3. Add this domain to the list of trusted hosts in the CORS header within your CMS system.
CORS

Step 2: Establishing CMS Connection

To establish a connection between your WordPress site and your Community, follow these steps:

    1. Ensure that you have an active and enabled Community. If you haven’t created one yet, please create a community first.
    2. In the Community Workspace, navigate to the Content Management section.
    3. Within the Content Management section, locate and select CMS Connect.
    4. 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:

    1. Enter a descriptive name for the connection.
    2. Set the CMS Source to “WordPress”.
    3. Choose the Connection Type as “Public”.
    4. Specify the Server URL as the domain URL of your WordPress site.
Connection Details

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:

    1. Content Name: This name will be referenced in Step 2 of the process.
    2. 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}
content lists
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.

    1. Go to the Community Builder.
    2. Create or Open an existing Community page, add the CMS Connect (JSON) component in the Content area.
    3. 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
display blog posts

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

 

Join the discussion 2 Comments

  • Pete Abby says:

    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.

Subscribe For More Updates

 

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!