Enforce version presence

Abstract

Set up an item or template to require an actual version in every language that has been added in Sitecore.

In a multilanguage solution, you can ensure that untranslated language versions do not return empty items. In versions prior to Sitecore 8.1, this resulted in the display of macros, such as $name, instead of real content and required custom coding.

With the enforce version presence feature you can now make sure that an item is only rendered for a specific language version of a website if there is a different language version of the item. When you enforce version presence of an item, the relevant translated language version of the item must be available for it to be returned from the API and displayed on the website.

By default, the enforce version presence feature is disabled. You must enable the feature on the relevant websites and on the relevant items or item templates.

To enforce version presence on a website:

  • Open \Website\App_Config\Include\Sitecore.config and set the attribute enforceVersionPresence to true. You must enable the attribute on each of the relevant websites.

    If the enforceVersionPresence attribute is not present, you can add it manually.

    Note

    Do not enable the enforceVersionPresence attribute on the shell or any other default site.

To enable enforce version presence on an item or a data template:

  • In the Content Editor, navigate to the relevant item or template, in the Advanced section, select Enforce Version Presence.

    Note

    You can also enable this on a base template to allow data templates to inherit the setting from there.