Content versioning configuration

When content versioning is enabled, Xperience by Kentico automatically stores previously published versions of reusable content items, pages, and headless items. Once content versioning is in use, storing newly published versions can be prevented in contexts where it’s not desirable.

Set up content versioning

Once enabled, content versioning starts tracking published versions. Only versions published after enabling it will be included in the version history.

  1. Open the Settings application.

  2. Select Content -> Content versioning.

  3. Select the Enable content versioning setting.

  4. Enter the Number of stored versions.

    • The number of versions determines how many published versions of one language variant of an item the system stores.
    • To track all versions that will be published, enter 0. However, we recommend considering whether you need all versions and how this affects your system’s performance.
      Storing too many versions can be detrimental to the system’s performance. The optimal number of versions depends on your project and environment. We don’t recommend storing more versions than you need.
  5. Save the settings.

    Save configuration

Permissions

The following table shows which permissions are needed for users to be able to restore a previous version of an item or view its version history.

Content

Permissions related to content versioning

Pages

Users with permission to Read a page can view its version history. Users with permission to Update a page can restore its previous versions.

Reusable content items

Users with the View permission for a workspace in Content hub can view version history for all items in that workspace. Users with Update permission for a workspace can restore previous versions of items in that workspace.

Headless items

Users with permission to View a headless channel application can view version history for all items in that channel. Users with Update permission for a headless channel application can restore previous versions of items in this channel.

An item can be restored when the item is in any workflow step. Users can restore a previous version of an item even when the item is in a step they don’t have permission for. The item is restored to the Draft step with the data from the selected version, and the item has to go through the regular workflow from the start.

Suspend versioning in custom code

If you need to suspend content versioning in custom code (for example, in integration scenarios), you can do so by enclosing the code into a using statement with a declared ContentItemVersionActionContext instance and the EnableStoreVersion property set to false.

C#
Example

using CMS.ContentEngine;
using CMS.Websites;
using CMS.Websites.Routing;

...

// Disables Versioning
using (new ContentItemVersionActionContext { EnableStoreVersion = false })
{
    ...

    await webPageManager.TryCreateDraft(pageId, languageName);

    ...

    // Page is published without creating a version in the version history
    await webPageManager.TryPublish(pageId, languageName);

}