Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Advanced features

Discover the advanced features Optimizely Graph provides when paired with Content Management System 12 (CMS 12).

Learn more about the advanced integration features available when connecting Optimizely Content Management System 12 (CMS 12) with Optimizely Graph. These include multilingual support, preview-mode integration in the user interface (UI), and custom content processing.

Multilingual support

Optimizely CMS 12 supports multilingual content through its globalization system. The Optimizely Graph integration detects and handles languages enabled in CMS 12, ensuring users receive information in their preferred language.

Configure language options

Configure language options by updating the QueryOptions settings. Optimizely Graph automatically reads language configuration from the globalization settings in CMS 12.

services.Configure<QueryOptions>(options =>
{
    // Language configuration is handled through CMS globalization settings
    // Content Graph will automatically detect enabled languages from CMS
});

Example: Multi-language content type

Use the ILocalizable interface to create content types that support localization.

[ContentType(DisplayName = "Multi-language Article")]
public class MultilingualArticle : PageData, ILocalizable
{
    [Display(Name = "Title")]
    public virtual string Title { get; set; }
    
    [Display(Name = "Content")]
    public virtual XhtmlString Content { get; set; }
    
    // Language-specific metadata
    public virtual string MetaDescription { get; set; }
}

After the content type is published, Optimizely Graph indexes each language version as a separate node, maintaining localization and metadata handling.

Preview mode integration

Configure Optimizely Graph to work with CMS preview mode. This lets editors preview content in front-end applications with live preview tokens.

Enable preview mode

To enable preview mode and sync preview URLs, configure the AddContentGraph service.

services.AddContentGraph(options =>
{
    options.EnableSynchronizeMenu = true; // Enables the UI menu
    
    options.Events.OnGeneratingPreviewUrl = context =>
    {
        // Generate preview URLs for front-end applications
        var baseUrl = "https://mysite.com";
        var previewUrl = $"{baseUrl}/api/preview?ref={context.ContentReference}&lang={context.Language.Name}";
        
        context.UpdateUrl(new Uri(previewUrl));
        return Task.CompletedTask;
    };
});

Configure preview UI options

Enable inline blocks and secure preview tokens for editors through the UI configuration in CMS 12.

services.Configure<UIOptions>(uiOptions =>
{
    uiOptions.UsePreviewTokens = true;
    uiOptions.InlineBlocksInContentAreaEnabled = true;
});

This configuration lets editors generate secure, shareable preview links for localized content.

Process content

Content processing and transformation occur within CMS integration’s event system and are applied before indexing in Optimizely Graph.

Implement custom content logic

Customize how content is processed before indexing by subscribing to CMS 12 content events.

public class CustomContentEventHandler : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        var events = context.Locate.Advanced.GetInstance<IContentEvents>();
        
        events.SavingContent += (sender, args) =>
        {
            // Transform content before it gets indexed
            if (args.Content is ArticlePage article)
            {
                // Add custom processing logic
                // The Content Graph integration picks up these changes
            }
        };
    }
}

Custom event handlers enable the transformation, validation, or enrichment of content before synchronization with Optimizely Graph. This is useful for adding computed fields, cleaning HTML, or applying transformations to metadata.