Content providers
Integrate external data into Optimizely CMS 13 using custom content providers. Implement the ContentProvider class and methods like LoadContent to display external data as native CMS content.
A content provider connects an Optimizely Content Management System (CMS) site to an external data source. The data appears as part of the CMS website while it remains at the source. Build multiple custom content providers to consolidate data into one CMS and give users an integrated experience. Content providers operate in the following ways.
- Data resides in original store – The data is not stored in the local CMS website database; the data source is integrated with CMS.
- Requires coding and configuration – Custom content providers must inherit from
ContentProvider. Register a provider throughContentOptions.ProvidersorIContentProviderManager. - IContent only – Data from a content provider displays as CMS content only.
- DefaultContentProvider technology – CMS uses the content provider concept internally. Local pages and content served by the CMS database also deliver through a content provider:
DefaultContentProvider. - Enable/disable content provider functionality – To move content between content providers, enable permissions in Admin view > Access Rights > Permissions for functions: Move between page providers. A warning dialog box displays when moving pages between providers.
NoteData handled by the content provider displays only as
EPiServer.Core.IContentinstances.
Register and configure a content provider through EPiServer.Core.IContentProviderManager or ContentOptions.Providers. See also Configure content providers.
Custom content providers and the ContentProvider class
Each registered content provider must inherit from the ContentProvider class in the EPiServer.dll assembly. A custom content provider requires only one abstract method:
LoadContent– Retrieves one content instance from the data store and returns it: an object implementing theIContentinterface (such asPageData).
Override additional ContentProvider methods to extend functionality. The following are common examples.
LoadChildrenReferencesAndTypes– Returns the content references and types for children of a specific node. Implement this method when the provider has an entry point and displays in the page tree.ResolveContent(ContentReference)– Resolves permanent links from aContentReferenceto a GUID and URI. Returns aContentResolveResultwith the internal link and GUID-based identifier when the content reference matches content served by this provider. Construct the URI with theConstructContentUri(contentTypeId, contentLink, contentGuid)helper method.ResolveContent(Guid)– Resolves permanent links from a GUID to aContentReferenceand URI. Returns aContentResolveResultwith the internal link and sets theContentReferenceidentifier when the GUID matches content served by this provider. Construct the URI with theConstructContentUri(contentTypeId, contentLink, contentGuid)helper method.
Updated 18 days ago
