Enforce version presence
Set up an item or template to require an actual version in every language that has been added in Sitecore.
In Sitecore, you can have different versions of an item, for example, different versions of an image or versions of an item in a different language. When an item doesn't have any item versions, and you try to fetch a version of that item, instead of returning NULL, Sitecore returns the non-versioned item. To change this behavior, and enforce the presence of a version, use the Enforce version presence feature. The feature ensures that an item version is returned only if it exists (in a database or resource). By default, enforce version presence is disabled; the setting is configured for each site separately, so it could be enabled on some and disabled on others.
You enforce version presence by first enabling it for the entire website, then configuring it for individual items. You can enable enforce version presence on individual items, or on all items based on an item template, by setting the configuration for the item or item template, respectively.
To enforce version presence:
Open the website configuration file (for example, under
\Website\App_Config\Sitecore.config) and set the
enforceVersionPresenceattribute to true. If the
enforceVersionPresenceattribute is not present, you can add it manually using a configuration patch file, for example:RequestResponsexml
<?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <sites> <site name="website"> <patch:attribute name="enforceVersionPresence">true</patch:attribute> </site> </sites> </sitecore> </configuration>Note
Don't enable the
enforceVersionPresenceattribute on the shell or any other default site.
To enforce version presence on an item or template, in the Content Editor, on the View tab, make sure that the Standard fields view is enabled.
Navigate to the relevant item.Note
To enable the feature for all items that are based on a certain template, apply the setting to the __Standard Values item of the template.
In the Advanced section, select the Enforce Version Presence check box.