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.
Once enabled, content versioning starts tracking published versions. Only versions published after enabling it will be included in the version history.
Open the Settings application.
Select Content -> Content versioning.
Select the Enable content versioning setting.
Enter the Number of stored versions.
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.
Save the settings.
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.
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.
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);
}