Newer Version Available
Example: Connect JSON Content to Your Community
Here’s an example of how to set up JSON content in your community using CMS Connect.
This example connects your community to a WordPress blog with JSON content.
Example
You have a Wordpress blog called Capricorn Cafe. You’d like to connect it to your
Salesforce community using CMS Connect. Here are example endpoints for a Content List and
Content Item:
- Content List: https://public-api.wordpress.com/rest/v1.1/sites/capricorncafeblog.wordpress.com/posts?number=6&page=1
- Content Item: https://public-api.wordpress.com/rest/v1.1/sites/capricorncafeblog.wordpress.com/posts/38
Set up JSON in your CMS connection:
- Follow the steps to create a CMS connection.
- For the server URL, enter https://public-api.wordpress.com/.
- You don’t need to enter a root path.
- In the JSON section, click Add JSON.
- Enter the following to add a list of blog posts:
- Name: Blog List
- Type: Content List
- Path: rest/v1.1/sites/capricorncafeblog.wordpress.com/posts?number={itemsPerPage}&page={pageNumber}
- Click Add JSON.
- Enter the following to add a single blog post:
- Name: Blog Item
- Type: Content Item
- Path: rest/v1.1/sites/capricorncafeblog.wordpress.com/posts/{component}
- Click Save.
Add the blog post to a page
- Create a new standard community page, using the “New Page” option.
- In the Builder, drag a CMS Connect (JSON) component on a page.
- In the property editor, select the CMS source that contains your JSON content.
- Select the name of your JSON content item (blog post), in this case Blog Item.
- For the component path, enter {!id}.
- For the content item layout, select Detail.
- Enter the following expressions in the Title, Author, Published On, Body, and Image
Source fields:
- @title
- @author/name
- @date
- @content
- @featured_image
- Click Save in the property editor.
Add the list of blogs to a page
- In the Builder, drag a CMS Connect (JSON) component on a page.
- In the property editor, select the CMS source that contains your JSON content.
- Select the name of your JSON content list, in this case Blog List.
- For the content list node path, enter @posts.
- For content list layout, select Grid.
- For items per page, enter 5.
- For columns, enter 2.
- For content list item layout, select Card.
- Enter the following expressions in the Title, Author, Published On, Body, and Image
Source fields:
- @title
- @author/name
- @date
- @content
- @featured_image
- In the Navigation Link section, enter Read More for the link text.
- For the type, select My Pages.
- For the page, select the name of the page that contains the content item (blog post).
- In the URL Parameter Mapping section, enter id for the name, and @ID for the value. (If you don’t see the Name and Value fields, click Add Parameter.)
- Click Save in the property editor.