Content versioning configuration

When content versioning is enabled, Xperience by Kentico automatically stores previously published versions of certain content items (reusable content items in the Content Hub, web pages, 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

  1. Open the Settings application.
  2. Select Content -> Content versioning.
  3. Select the Enable content versioning setting.
  4. Enter the Number of stored versions.
    Number of stored versions
    • The number of versions determines how many published versions of one language variant of a content item the system stores.
    • To store an unlimited amount of versions, enter 0. We recommend not using this setting unless you really need an unlimited amount of versions and you are sure that the performance of your project won’t be affected.
    • 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 actually need.
  5. Select Save.

Save configuration

Permissions

Users with permission to Read or View a content item can view the version history, and users with Update permission can restore a previously published version of the content item. These permissions are determined by existing permissions for pages, workspaces, workflows, and applications where respective content items are edited.

A content item can be restored when the current version of the item is in any workflow step. This means that users with permission for any workflow step can restore a version. However, restoring moves the item to the Draft step with the data from the selected version, and the item has to go through the workflow where regular workflow permissions apply.

Suspend versioning in custom code

If you want to suspend content versioning in certain cases (for example, in integration scenarios or when programmatically uploading or publishing a large amount of content), 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);

}