HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

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 through ContentOptions.Providers or IContentProviderManager.
  • 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.
📘

Note

Data handled by the content provider displays only as EPiServer.Core.IContent instances.

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 the IContent interface (such as PageData).

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 a ContentReference to a GUID and URI. Returns a ContentResolveResult with the internal link and GUID-based identifier when the content reference matches content served by this provider. Construct the URI with the ConstructContentUri(contentTypeId, contentLink, contentGuid) helper method.
  • ResolveContent(Guid) – Resolves permanent links from a GUID to a ContentReference and URI. Returns a ContentResolveResult with the internal link and sets the ContentReference identifier when the GUID matches content served by this provider. Construct the URI with the ConstructContentUri(contentTypeId, contentLink, contentGuid) helper method.