Newer Version Available

This content describes an older version of this product. View Latest

Create Custom Content Types for Salesforce CMS

You can use your Salesforce CMS content in your Experience Builder sites. Salesforce CMS provides the News, Image, and Document content types that are flexible enough to create many different types of content. But if you need more specific content types such as blogs, events, or product layouts, you can create custom content types using Metadata API.
Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions

User Permissions Needed
To create workspaces and channels in the Salesforce CMS app:
  • Modify All Data
  • OR Create CMS Workspaces and Channels
To manage content, contributors, and channels within a Salesforce CMS workspace:
  • Assigned a content admin role in that CMS workspace
  • AND, if adding Experience Cloud site channels, Create and Set Up Experiences
To only manage content within a Salesforce CMS workspace: Assigned a content manager role in that CMS workspace
To create an Experience Cloud site
  • Create and Set Up Experiences
  • AND View Setup and Configuration
To access an Experience Builder site’s Content Management workspace:
  • Create and Set Up Experiences
  • AND is a member of the site
To customize an Experience Builder site:
  • Create and Set Up Experiences OR assigned an experience admin, publisher, or builder role in that site
  • AND is a member of the site

Alternatively, you can use the CMS Content Type Creator in AppExchange to get started.

Tip

Create custom content types as XML files using the ManagedContentType type. When you create a custom content type, it appears as a form for adding content in the Salesforce CMS app. A custom content type is organized as groups of attributes that comprise nodes. Each node represents a field in the form.

After content is published to your Experience Builder site through the Salesforce CMS app, fields can be positioned, styled, and sometimes used as an overlay on images.

  • Custom content types can only be created, edited, and deleted using the API.
  • You can have up to 20 active custom content types in your org, in addition to the standard content types. To add more, contact Salesforce.

Note

To create a custom content type, take these steps.

  1. Before you begin, think about the information that your custom content type must include. Identify the information that you want to be able to manipulate or highlight when the content is displayed on a site page. Design the form with those items as their own fields. For example, to create an events content type, you likely require a title, location, date, and description field.

    Each custom content type can have 15 nodes maximum. Each node is a single field in the resulting form.

    Note

  2. To identify your custom content, create a node of type NAMEFIELD. Typically, a title field type is the most useful.

    Each content type needs one node of type NAMEFIELD. The NAMEFIELD value appears as the content name in the Salesforce CMS CMS app, Experience Workspaces, and in Experience Builder components, for example, in the list of available content.

    Note

    Create the rest of the XML file that represents your plan.

  3. As you add the other fields, decide which are required (isRequired) and which are optional. Then consider whether they need placeholderText or helpText to guide your content creators about what kind of information is expected or allowed. Also, if working with multilingual sites, decide which fields to localize (isLocalizable).
  4. To test the form in the Salesforce CMS app, add the content type to your org. Publish and test content created using the new content type in a site to confirm that you can achieve the layouts you require.

Example

With these steps in mind, now let's tackle an enhanced Blog custom content type.

This content type gives you the same rich text as News, but with extra fields such as Author Name and Category. You can use these fields for marketing, by calling out the author as an expert, or visual highlighting a product as "New!".

Let's map out the fields to make sure we cover our needs before creating the XML file.

Field Name Field Type Other attributes Required?
Blog Title text

Designated NAMEFIELD for easy identification in lists

placeholder text: Enter an SEO-friendly title...

helptext: Title to be shown in the blog post

Yes
Primary Image image helptext: Main image that's shown at the top of the blog post No
Main Content rte

A rich text editing area with limited formatting and freeform structure.

Note

helptext: Blog's main body Yes
Excerpt text No
Category text helptext: Shown as tag text when a preview is rendered Yes
Author Name text No
Date to Show text No
Footer Content rte helptext Yes
Content Slug System added Yes

The following ManagedContentType example shows the definition of our enhanced Blog custom content type.

1<?xml version="1.0" encoding="UTF-8"?>
2<ManagedContentType xmlns="http://soap.sforce.com/2006/04/metadata">
3    <description>Engineering blogs published on salesforce.com/devblog</description>
4    <developerName>engBlog</developerName> 
5    <managedContentNodeTypes>
6        <helpText>Title to be shown in the blog post</helpText>
7        <isLocalizable>true</isLocalizable>
8        <isRequired>true</isRequired>
9        <nodeLabel>Blog Title</nodeLabel>
10        <nodeName>title</nodeName>
11        <nodeType>NAMEFIELD</nodeType>
12        <placeholderText>Enter an SEO friendly title...</placeholderText>
13    </managedContentNodeTypes>
14    <managedContentNodeTypes>
15        <helpText>Main image that's shown at the top of the blog post</helpText>
16        <isLocalizable>false</isLocalizable>
17        <isRequired>false</isRequired>
18        <nodeLabel>Primary Image</nodeLabel>
19        <nodeName>primaryImage</nodeName>
20        <nodeType>IMG</nodeType>
21    </managedContentNodeTypes>
22    <managedContentNodeTypes>
23        <helpText>Blog's main body</helpText>
24        <isLocalizable>true</isLocalizable>
25        <isRequired>true</isRequired>
26        <nodeLabel>Main Content</nodeLabel>
27        <nodeName>body</nodeName>
28        <nodeType>RTE</nodeType>
29    </managedContentNodeTypes>
30    <managedContentNodeTypes>
31        <isLocalizable>true</isLocalizable>
32        <isRequired>false</isRequired>
33        <nodeLabel>Excerpt</nodeLabel>
34        <nodeName>excerpt</nodeName>
35        <nodeType>MTEXT</nodeType>
36    </managedContentNodeTypes>
37    <managedContentNodeTypes>
38        <helpText>Shown as a tag text when a preview is rendered</helpText>
39        <isLocalizable>true</isLocalizable>
40        <isRequired>true</isRequired>
41        <nodeLabel>Category</nodeLabel>
42        <nodeName>category</nodeName>
43        <nodeType>TEXT</nodeType>
44    </managedContentNodeTypes>
45    <managedContentNodeTypes>
46        <isLocalizable>true</isLocalizable>
47        <isRequired>false</isRequired>
48        <nodeLabel>Author Name</nodeLabel>
49        <nodeName>authorName</nodeName>
50        <nodeType>TEXT</nodeType>
51    </managedContentNodeTypes>
52    <managedContentNodeTypes>
53        <isLocalizable>true</isLocalizable>
54        <isRequired>false</isRequired>
55        <nodeLabel>Date to Show</nodeLabel>
56        <nodeName>date</nodeName>
57        <nodeType>TEXT</nodeType>
58        <placeholderText>Enter human readable date</placeholderText>
59    </managedContentNodeTypes>
60    <managedContentNodeTypes>
61        <helpText>Blog's footer</helpText>
62        <isLocalizable>true</isLocalizable>
63        <isRequired>true</isRequired>
64        <nodeLabel>Footer content</nodeLabel>
65        <nodeName>footer</nodeName>
66        <nodeType>RTE</nodeType>
67    </managedContentNodeTypes>
68    <masterLabel>Blog</masterLabel>
69</ManagedContentType>
After you add the content type, a user who selects the Blog content type when adding content in the Salesforce CMS app sees the following form.Blog content type as a form

Create a Content detail page for the content type in Experience Builder.

Edit Custom Content Types for Salesforce CMS to add new fields or change the properties of existing fields in custom content types.