Content types
Describes the content type resource for CMS (SaaS) and how to create and manage them.
In Optimizely Content Management System (CMS) (SaaS), a content type defines the characteristics and data model schema of a content item. It serves as the foundation for creating experiences, pages, or block instances by specifying properties that hold information, such as links to images, web pages, or editorial text. A typical application utilizes a set of content types tailored to its functional needs.
To explore content types further, see the interactive demo and refer to the end-user documentation on Content types.
Content types
- must be mapped to their corresponding renderings to display content to visitors in Visual Builder.
- often support the localization of data.
- include a lifecycle feature to help manage publishing.
- are registered in a corresponding graph schema within Optimizely Graph.
Content types
A content type refers to a specific type of content object within CMS (SaaS), such as a page, block, or media type. It defines the structure and properties of that content, including fields and settings that are unique to that type. For example, an image content type might include properties for file extension and dimensions.
The main models for content types are the following:
- Page Type – Content that you can display with a template and unique URL, used to represent a webpage on your application.
- Block Type – A component or module that makes up a portion of a web page. It is reusable content you can display with a template, and it does not have a URL.
- Media types – Any file you want to load into CMS (SaaS).
- Images – Example file types: .jpg, .png, .webp, .svg, .gif, .tiff, and so on.
- Video – Example file types: .mp4, .avi, .mov, .wmv, .webm, .mkv, .ogg, and so on.
- Media – Every other file type such as .pdf, .docx, .mp3, .zip, .iso, .ttf, .js, .css, and so on.
- Experience Type – Extension of the page type, enhanced to work with Visual Builder.
- Section Type – Helps organize your content in an experience type in Visual Builder.
Note
The Section Type is not available as an option to create in the CMS (SaaS) UI.
- Element Type – Extension of the block type, enhanced to work with Visual Builder.
Note
Visual Builder is the editor interface in CMS (SaaS) that makes content creation and layout building intuitive.
- Content creators can design, modify, and reuse layout templates directly in the user interface and create adaptable experiences for any channel without the need for developer involvement.
- Front-end developers can set design template (style) options for the content creators to choose the style of the created content while adhering to brand guidelines.
Base type
The content type has a specific type, known as the base type. Each base type comes with characteristics such as how an editor manages an instance of the content type.
A base type is a more general classification that groups similar content types together. It serves as a foundational category from which specific content types inherit common properties and behaviors. For instance, all blocks might share a base type, and all pages might share another base type. This permits common settings and templates to be applied across all content types within that base type.
Note
You cannot change the base type after you create the content type.
Base types available in CMS (SaaS) are the following:
component
– A generic content type used as a field on other content instances or as a standalone instance. It supports multiple locale branches.page
– Represents a web page. Each content instance is unique. It supports multiple locale branches. You cannot model this field type as fields on other content types.media
– Represents content with associated binary data, a generic content type for binary data. Content instances based on media do not support multiple locale branches.image
– Used to store image binary data. Does not support multiple locale branches.video
– Used to store video binary data. Does not support multiple locale branches.folder
– Used to organize other content. Does not support multiple versions or multiple locale branches.experience
– Represents an experience. Each content instance is unique, supports multiple branches, and cannot be used as a field on other content types. Can contain a dynamic layout similar to a content area with nested blocks, but instead made up of sections and elements.section
– Represents a section, part of an experience through its layout field. Each instance is unique, supports multiple branches, and cannot be used as fields on other content types. It can contain a dynamic layout like an experience with the difference that it only can contain elements.element
– Represents an element, part of a section. Each instance is unique, supports multiple branches, and cannot be used as fields on other content types. An element is similar to a block in many ways and constitutes the leaf in the hierarchy of experiences and sections. It contains the actual authored content.
Standard fields
Every content type comes with many built-in, standard fields that describe the behavior of content instances of that content type. These fields help define the structure and attributes of the content.
key
– The unique identifier of a content type used in the API.displayName
– A user-friendly name for the content type used, such as in the UI for editors.description
– A description of the content type used, such as in the UI for editors.baseType
– The base type of the content type.sortOrder
– A relative index used in some listings to define the order of content types.mayContainTypes
– A list of content types that you can create under content instances of the content type. It can be a content type key or the name of a base type.features
– A list of features that these content types have. The value of this field is derived from the base type and cannot be changed.usage
– Defines where you can use this content type. The base type derives the value of this field, and you cannot change it. Possible values are:property
– Indicates that you can use the content type as a component property.instance
– Indicates that you can create the content type as a standalone instance.
source
– A string indicating the source of this content type. It is empty for content types added through the UI and set to system for built-in content types.created
– A timestamp indicating when someone created the content type.lastModified
– A timestamp indicating when someone last modified the content type.lastModifiedBy
– A string indicating the username of the person that last modified this content type.
Properties
Each content type can have properties that specify the content model. Depending on the property type, you can define different validations and editor settings for the property. Each property should have a unique string-based key within the content type. You can define properties for a content type in a Properties
dictionary with the key and the property.
type
– The property's data type. Must be one of the listed in Data types.format
– A reference to a predefined data format, including validation rules, an editor, and editor settings.displayName
– A user-friendly name for the content type used, such as in the UI for editors.description
– A description of the content type used, such as in the UI for editors.localized
– Indicates if the property has a different value for each locale or if the same value should apply to all locales.required
– Indicates if someone must give a value to the property.group
– A reference to the group under which this property is organized.sortOrder
– A relative index used in some listings to define the order of content types.editor
– A reference to an editor specification that defines the editor used.
Note
Validation settings have multiple API fields that apply to this property. Which ones are available depend on the data type of the property.
Property formats
The property format on a content type property references a predefined format. The format is preset that defines validation rules, which editor to use, and settings for that editor. A format is associated with a specific data type.
Read more about property formats.
Data types
Every content property has a data type.
string
– A string value.boolean
– A Boolean value (true, false, or not set).integer
– A whole number.float
– A fractional number.dateTime
– A date time. The API will provide this value as a string formatted according to the extended ISO 8601-1:2019 profile. For example,2023-09-26T15:47:52Z
.contentReference
– A reference to another content instance.binary
– A reference to a binary stored in CMS (SaaS).content
– Represents a composition of another content item (inline or referenced).component
– Represents a composition of another content item of a specific content type (inline only).array
– A list of values you must specify with the item's data type in the array.
Complex data in CMS (SaaS) is defined using a content type. You can assign the content type to a property with a component
or content
data type. The content type of a component
property is predefined and is the same, while you can assign any content type to a content
property unless limited to a specific set.
Validation fields
You can apply validation fields to individual properties. The settings that are available depend on the data type of the property to which it is applied. Validation fields ignore fields that do not apply to the data type.
maxLength
(string, array) – Maximum length of a valid string or array.pattern
(string) – The string must adhere to a regular expression pattern.allowedTypes
(content, contentReference) – An array of content types that are allowed in the property.restrictedTypes
(content, contentReference) – An array of content types that are not allowed in this property. It has priority overallowedTypes
.minimum
(integer, float, dateTime) – The property's minimum value. Inclusive.maximum
(integer, float, dateTime) – The property's maximum value. Inclusive.enum
(string, integer, float) – A list of valid possible values for the property.
GET https://example.com/_cms/preview2/contenttypes?forContainerType=news
Updated 1 day ago