A great benefit of implementing workflow in Sitecore is the ability to have multiple versions of your content automatically. Content authors will not have to manually configure new versions on their own. Workflow will do this for us behind the scenes. With versioning enabled, we will be able to…
- Revert a page and its content to a previous version easily without having to re-author the content from scratch
- Keep historical record of what a page looked like and easily surface what something looked like in the past
- Work on a new version of a page while keeping an older version live on the public-facing site
How does this work?
Sitecore will only publish the highest numbered approved version of a piece of content to the live site. The keyword in that sentence is the word “approved”. You can have as many versions of a piece of content in the “Draft” state as you want. That will not impact what will be seen on the live site. Only approved versions matter for what is available for viewing. Thus, if you have 10 versions of a page with versions 1-8 in the “Approved” state, version 9 in the “Awaiting Approval” state, and version 10 in “Draft” state, version 8 will be what is viewable on the live site since it is the highest numbered “Approved” version of the page. If your piece of content has multiple language versions associated with it, the latest version in that given language will be what is publishable to the live site.
What does this look like in Sitecore?
Designing, building, and implementing top-notch experiences not only requires a great deal of planning, strategy, and time – it also requires the right digital experience platform (DXP) and the right development approach for your business needs.
On any given Sitecore item, you can see what version you are working on by looking in the top right corner of the item. In the screenshot above, you can see I am viewing version 4 of my Home page. Clicking on the version number lets you see the versions available for editing as seen below:
Clicking on a version in this dropdown will show you the field values on this item in that version.
Creating a new version of an item
To create a new version of an item, all a content author has to do is simply lock and edit an approved version of the item. Content authors will no longer have to go to the version dropdown and manually add a new version of the item to start editing. Workflow makes it possible to only have to lock and edit to get a new version. Locking and editing a version of an item in “Draft” state will not create a new version. It will simply allow you to edit the “Draft” item until you are ready to submit it for approval.
Reverting to a previous version of an item
If you would like to revert an item to a previous version of itself, you will have to lock and edit the version you want to revert to. For example, if you are currently displaying Version 3 of an item on the live site but you want to revert to showing Version 2, you must lock and edit Version 2. This will then create a Version 4 in the “Draft” state with all of Version 2’s content populated in the field values. You will then have to submit Version 4 through the workflow approval process. After getting Version 4 approved, it will be able to be published to the live site and show the reverted values you wanted to see again.
Sitecore recommends that you only have 10 versions max of any item in Sitecore at any given time for performance reasons. In my next blog post in this mini-series, we will go over how to create an automated weekly task that will archive older approved versions of items to keep our content under that 10-version limit.