HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Customize the editing preview for media

Describes how to customize the editing preview for images or video, and add an editing preview for a media type.

Optimizely comes with default editing previews for image and video-typed content data. However, you may need to customize the editing preview for images or video or add an editing preview for a media type. You can add or change a preview in the templating system in Optimizely.

Customize a preview template

Sites often have a specific design for media content, such as displaying a caption with each image or displaying a document as a link with size and format information. To add a useful preview for editors in edit mode. Add a template with a TemplateDescriptor attribute that is tagged as preview. Then extend the IRenderTemplate<T> class where T is the content type to preview as shown in the following example that registers an MVC controller as a preview template for Document.

[TemplateDescriptor(Tags = new [] {
public partial class DocumentPreview: ContentController<Document> {
  //Do some custom preview for document

Enable On-page edit view

For media that is not an image or a video, the on-page edit mode is turned off by default because there is nothing to display in the editing preview. However, if you add an editing preview for a new type, then it follows that you may want to have on-page edit mode enabled for that type. Add a UIDescriptor for your media content type to override the default settings for media content. Then, you can specify which edit view is the default and, if required, turn off particular edit views.

The following example creates a UIDescriptor for a document content type, set the default edit view to All Properties view.

public class DocumentUIDescriptor: UIDescriptor<Document> {
  public DocumentUIDescriptor(): base("icon-document") {
    DefaultView = CmsViewNames.AllPropertiesView;