When it comes to versioning in Sitecore there are some things that are obvious, and some things that are not. You can, at any time, add a version for an item from within Content Editor, selecting the Versions
tab and clicking Add
. Removing a version is equally as easy by clicking the Remove
button.
When it comes to Media
items, you can create versions as well. There is a key difference however as Media
items come in two flavours, Versioned
and Unversioned
. By default, whenever you upload a media item it will be identified as Unversioned
. It is, however, just a Sitecore item so versions can still be applied.
Upload Versionable Through Advanced Menu Option
If you want to upload a media item and make it versionable, then you can use the Upload files (advanced)
option.
You can then select Make uploaded media items versionable
.
Enabling Media Versioning By Default
Let's say we want to make it such that media items are not only versioned by default but that they have a workflow attached, to maintain the versioning rather than just require the user to Add
a new version.
Create A Patch Config
The easiest way to force media versioning is through the use of a config patch file, such as the one below that changes Media.UploadAsVersionableByDefault
.
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Media.UploadAsVersionableByDefault" value="false">
<patch:attribute name="value">true</patch:attribute>
</setting>
</settings>
</sitecore>
</configuration>
Now when you upload a file normally, it will automatically be assigned as Versioned
.
If you desired to add a workflow to an appropriate type or media items as a whole, you would then assign it to one of the Versioned templates listed below. Each type inherits from File
.