Loading...
Area: Optimizely CMS
Applies to versions: 10 and higher
Other versions:
ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.

Content

Recommended reading 
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.

When developing your solution, plan a content type model hiearchy, and use class inheritance to reduce code and access built-in features in Optimizely. Use MVC conventions for controllers, models, and views. This provides flexibility when extending your solution, and you can easily create new content types by adding model classes.

Create for example a page type that implements IContent to get the basic properties, and add custom properties like author, an editorial area and publish date. 

Example: A page type created using the Optimizely Visual Studio extension.

namespace MyOptimizelySite.Models.Pages
{
  [ContentType(
                 GroupName = "Basic pages",
                 Order=1,
                 DisplayName = "StandardPage",
                 GUID = "abad391c-5563-4069-b4db-1bd94f7a1eea", 
                 Description = "To be used for basic content pages.")]
  public class StandardPage : SitePageData
  {
    [CultureSpecific]
    [Display(
               Name = "Main body",
               Description = "The main body will be shown in the main content area of the page, using the XHTML-editor you can insert for example text, images and tables.",
               GroupName = SystemTabNames.Content,
               Order = 1)]
    public virtual XhtmlString MainBody { get; set; }
  }
}

Settings defined in the user interface take precedence over settings from your model, and content types can be added and modified from the administrative user interface. However, these will not be strongly typed, and therefore this approach is not recommended. Managing content types from code also makes deployment to multiple environments easier.

Initialization and synchronization

During site initialization all assemblies in the bin folder are scanned, and all classes decorated with the EPiServer.DataAbstraction.ContentType attribute are added by the synchronization engine. A content type is constructed by merging the settings from the model class with any settings that have been defined in the administration view.

You can see examples of different content types if you install an Optimizely CMS sample site.

Built-in functionality

When using the Optimizely content model, certain functionality is available by default for all content types. You get for example waste basket support, content reference checking when deleting content items, and drag-and-drop support from the assets pane into any overlay or editor that handles files.

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Jul 02, 2021

Recommended reading