Exam Area: Content Area 1 – Product Knowledge (15%)
Reference: https://docs.developers.optimizely.com/content-management-system/docs/properties
Every content item has the following properties available by default (no declaration needed):
| Property | Type | Description |
|---|---|---|
ContentLink | ContentReference | Unique ID of the content |
ContentGuid | Guid | Immutable GUID |
ContentTypeID | int | ID of the content type |
Name | string | Display name in page tree |
URLSegment | string | URL slug |
ParentLink | ContentReference | Reference to parent |
Status | VersionStatus | Status (Published, Draft...) |
StartPublish | DateTime? | Start publish time |
StopPublish | DateTime? | Expiry time |
Changed | DateTime | Last modified time |
ChangedBy | string | Last editor |
Created | DateTime | Creation date |
CreatedBy | string | Creator |
IsDeleted | bool | Whether moved to Trash |
| Property | Type | Description |
|---|---|---|
PageName | string | Page name |
PageTitle | string | HTML <title> |
PageDescription | string | Meta description |
PageKeywords | string | Meta keywords |
PageURLSegment | string | URL segment |
PageVisibleInMenu | bool | Show in navigation |
PagePeerOrder | int | Sibling sort order |
ExternalURL | string | External redirect |
VisitorGroupsLink | Applied visitor groups |
// Common property types in CMS 12
public class MyPage : PageData
{
// Text
public virtual string ShortText { get; set; }
public virtual XhtmlString RichText { get; set; } // TinyMCE editor
// Numbers
public virtual int Number { get; set; }
public virtual double FloatingPoint { get; set; }
public virtual long LongNumber { get; set; }
// Boolean
public virtual bool IsActive { get; set; }
// Date/Time
public virtual DateTime? PublishDate { get; set; }
// Content References
public virtual ContentReference Link { get; set; } // 1 content item
public virtual ContentArea ContentArea { get; set; } // Multiple items
public virtual IList<ContentReference> Items { get; set; } // List
// URL
public virtual Url ExternalLink { get; set; }
// Media
public virtual ContentReference Image { get; set; }
// Selection
[SelectOne(SelectionFactoryType = typeof(MySelectionFactory))]
public virtual string Status { get; set; }
// Category
public virtual CategoryList Categories { get; set; }
}
[Display(
Name = "Heading",
Description = "Main heading of the page",
GroupName = SystemTabNames.Content, // Tab
Order = 10 // Order within the tab
)]
public virtual string Heading { get; set; }
SystemTabNames.Content – "Content" tabSystemTabNames.Settings – "Settings" tab"SEO" – Custom tab// Declaration
[Display(Name = "Main Body")]
public virtual XhtmlString MainBody { get; set; }
// Render in View (automatically enables TinyMCE)
@Html.PropertyFor(m => m.MainBody)
TinyMCE editor is automatically used for XhtmlString.
// Hide property from Edit UI
[ScaffoldColumn(false)]
public virtual int InternalField { get; set; }
// Hint the type of editor
[UIHint(UIHint.Image)]
public virtual ContentReference Image { get; set; }
[UIHint(UIHint.Video)]
public virtual ContentReference Video { get; set; }
[UIHint("textarea")]
public virtual string LongText { get; set; }
using System.ComponentModel.DataAnnotations;
[Required]
[Display(Name = "Title")]
public virtual string Title { get; set; }
[StringLength(200)]
[Display(Name = "Description")]
public virtual string Description { get; set; }
[Range(1, 100)]
public virtual int Priority { get; set; }
@* Enable on-page editing for a property *@
@Html.PropertyFor(m => m.Heading)
@* Or using Tag Helpers (CMS 12) *@
<epi-property name="Heading" model="@Model"></epi-property>
public class ArticlePageController : PageController<ArticlePage>
{
public ActionResult Index(ArticlePage currentPage)
{
// currentPage contains all properties
var heading = currentPage.Heading;
var body = currentPage.MainBody;
return View(currentPage);
}
}
PageData contains the HTML title? (PageTitle)XhtmlString use? (TinyMCE)[Display(GroupName = "...")])ContentArea used for? (Holds multiple content items/blocks)[ScaffoldColumn(false)] do? (Hides the property from the Edit UI)[Required] come from? (System.ComponentModel.DataAnnotations)