IContent Interface Reference
Corecms
Overview
Section titled “Overview”IContent is the base interface for all content items in Optimizely CMS. Every page, block, media file, and folder implements this interface. When you work with the content API, you interact with IContent and its derived interfaces.
Interface hierarchy
Section titled “Interface hierarchy”IContent├── IContentData → Base data contract├── ILocalizable → Language support├── IVersionable → Version tracking├── IChangeTrackable → Created/modified dates└── ICategorizable → Category assignment └── PageData → Pages with URLs └── BlockData → Embeddable blocks └── MediaData → Files and imagesProperties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
ContentLink | ContentReference | Unique identifier for this content version |
ContentGuid | Guid | Permanent GUID that persists across versions |
ContentTypeID | int | ID of the content type definition |
ParentLink | ContentReference | Reference to the parent content item |
Name | string | Display name of the content item |
IsDeleted | bool | Whether the item is in the trash |
Key derived interfaces
Section titled “Key derived interfaces”IVersionable
Section titled “IVersionable”| Property | Type | Description |
|---|---|---|
Status | VersionStatus | Draft, Published, PreviouslyPublished, Rejected, CheckedOut, DelayedPublish |
StartPublish | DateTime? | When the content becomes visible |
StopPublish | DateTime? | When the content expires |
IsPendingPublish | bool | Whether scheduled for future publish |
IChangeTrackable
Section titled “IChangeTrackable”| Property | Type | Description |
|---|---|---|
Created | DateTime | When the content was first created |
Changed | DateTime | When the content was last modified |
Saved | DateTime | When the content was last saved |
CreatedBy | string | Username who created the content |
ChangedBy | string | Username who last modified |
ILocalizable
Section titled “ILocalizable”| Property | Type | Description |
|---|---|---|
Language | CultureInfo | Language of this content version |
MasterLanguage | CultureInfo | The original language |
ExistingLanguages | IEnumerable<CultureInfo> | All available language versions |
Common operations
Section titled “Common operations”Load content by reference
Section titled “Load content by reference”var content = _contentLoader.Get<IContent>(contentLink);Load typed content
Section titled “Load typed content”var page = _contentLoader.Get<ArticlePage>(contentLink);Check content type
Section titled “Check content type”if (content is PageData page) { /* page-specific logic */ }if (content is BlockData block) { /* block-specific logic */ }Get children
Section titled “Get children”var children = _contentLoader.GetChildren<PageData>(parentLink);Get ancestors
Section titled “Get ancestors”var ancestors = _contentLoader.GetAncestors(contentLink);Related
Section titled “Related”- Content Modeling in Optimizely — How content types and properties work
- Create a Content Type — Step-by-step guide