Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Built-in property types

Describes how to use built-in property types in your models and also create your own property types.

Optimizely Content Management System (CMS) content is built up by models with properties that store and present data. You can use many built-in property types in your models and create your own.

Common property types

What you want to createSolutionEditing experienceHints and tips
Plain short textString propertyOne row inputControl the allowed length with the StringLength attribute. Use custom tag to control the containing tag, such as using a H1 for the main header for the page.
Plain long textString property with UIHint.TextareaText areaControl the allowed length with the StringLength attribute.
HtmlXHtmlString propertyA TinyMCE HTML editor
Integer valueInt propertyA number sliderControls other rendering, such as the number of items in a list. Control the min and max values with the Range attribute.
Date and timeDateTime propertyA date and time pickerControl the min and max values with the Range attribute.
DoubleDouble propertyCheck editorControl the min and max values with the Range attribute.
BooleanBoolean propertyCheck box
Page typePageType propertyFilter items in a list, and so on.
BLOBBlob propertyHold binary data (such as an image). Route to a BLOB with pattern <Url to content>/BlobPropertyName.

Work with other content

To refer to existing content, use the Link or LinkCollection to create internal or external links.

  • Use ContentArea to display content from other content.
  • Use ContentReference, ContentReferenceList, or URL to link to a single content of a specified type.
  • Use the AllowedTypes attribute to further restrict the kind of links that are possible to add to a property (although there are a few known limitations).

Use a content reference with many different UI hints to select different entities in CMS, such as a block, a media item, a block folder, or a media folder.

What you want to create

Solution

Editing experience

Hints and tips

Link to a page

PageReference property

Content picker with
drag and drop support

 

Link to a media file of any type

ContentReference property
with UIHint.MediaFile

Content picker with
drag and drop support

Link to any file in the media repository. Use ContentReference instead of using standard content rendering. (Mostly for backwards compatibility.)

Link to an image

ContentReference property
with UIHint.Image

Content picker with
drag and drop support

Lets an editor select content in the media repository by implementing IContentImage.

Link to a video

ContentReference property
with UIHint.Video

Content picker with
drag and drop support

Lets an editor select content in the media repository by implementing IContentVideo.

Link to a media file with the possibility to append information in the URL

Url property with
UIHint.MediaFile or
UIHint.Image or
UIHint.Video

Content picker with
drag and drop support

Each link can be an item inside CMS, such as pages or media but also external URLs. Use URL instead of ContentReference if you want to add information, such as query string parameters, to control size.

Content area

ContentArea property

 

 

URL

Url property

Link dialog with drag-and-drop support

 

Link to multiple external and/or internal resources

LinkItemCollection
property

Link collection editor with drag-and-drop support

Does not support AllowedTypesAttribute.

Link to multiple internal pages, media files, or another content type.

ContentReferenceList property

Content picker with
drag and drop support

Supports AllowedTypesAttribute.

Select predefined values

You can use the following solutions to create drop-down lists and check box lists:

What you want to createSolutionEditing experienceHints and tips
Select a single item from a relatively short list of optionsString/Int property with SelectOne attributeLink to implementation
page
Select several items from a relatively short list of optionsString/Int property with SelectMany attributeLink to implementation
page
Select a single item from a relatively long list of optionsString/Int property with AutoSuggestion attributeLink to implementation
page
Use with caution because the auto-suggestion editor creates requests to the server.

Validation attributes

CMS supports the following validation attributes that are part of the .NET:

  • Range
  • StringLength
  • RegularExpression
  • EmailAttribute

You can create custom attributes that implement ValidationAttribute.