logo
logo

Variants

The variants feature lets you create variants of existing entities to customize content for a specific target group (audience, market, country, culture). You can customize any entity definition (content, product).

This section contains the following:

  1. Enable variants
  2. Create a Variant operation
  3. Link a View variants detail page
  4. Create a Detach variant operation
  5. Disable variants
  6. Out-of-the-box variants
  7. Export variant-related entities
Note

This section refers to the Entity operation page component, but focuses on variants-related configuration parameters.

Enable variants

To create entity variants, enable the Variants functionality on the target entity definition:

  1. On the menu bar, click Manage .
  2. On the Manage page, click Schema, then click the target entity definition.
  3. At the top of the entity definition page, click Actions , and then click Enable/Disable.
  4. In the Enable/Disable dialog box, turn on the Variants switch .
  5. Click Done.

Enabling the Variants functionality automatically:

  • Adds the {Definition}To{Definition}Variant and {Definition}IsVariant members to the entity definition.
  • Creates a default Variant copy profile.
  • Adds a View variant detail page under the Variants parent page in Manage > Pages.
  • Enables the Create variant and Overwrite values operations for the Entity operation page components.
  • Adds the VARIANT and ORIGINAL indicators on the respective pages.
Note

Variants are enabled by default for content in Sitecore Content Marketing Platform (CMP)™. For further details, see Variants.

Create a Variant operation

To configure the Variant operation, on the target page:

  1. On the menu bar, click Manage .
  2. On the Manage page, click Pages, then select the target page.
  3. Select an existing, or create a new Entity operation page component.
  4. In the Entity operation component, add a Create variant operation.
  5. To add a copy profile, click , and select a copy profile from the list.
  6. To define the fields used to create the variant, click Add field, and select the desired fields from the list.
  7. Select the required field(s) for the variant creation (optional).
  8. Click Save.
Note

When you define a required field, a validation check forces you to pick a value different from the original when creating a variant.

Link a View variants detail page

Important

By default, the View variants detail page does not display any output. It needs to be configured to do so.

For the View variants detail page to filter and display the related entity variants, you need to configure it.

To link the View variants detail page to the target entity page:

  1. On the menu bar, click Manage .
  2. On the Manage page, click Pages, then select the target entity page.
  3. In the Entity operation page component, add a View detail page operation.
  4. Link the auto-generated variant detail page to this operation.
  5. Click Save.

Create a Detach variant operation

With the variant feature, you can save a variant as a standalone entity by applying a copy profile on the variant entity to detach it from its original entity.

To detach a variant from its original entity, configure an Overwrite values operation as follows:

  1. On the menu bar, click Manage .
  2. On the Manage page, click Pages, then select the target entity page.
  3. In the Entity operation page component, add an Overwrite values operation.
  4. To add a copy profile configured to detach a variant, click , and select the copy profile in the list.
  5. Click Save.

To detach a variant from its original entity, the copy profile used should at least contain the following:

{
    "method": "Remove",
    "name": "{Definition}To{Definition}Variant"
},
{
    "method": "Overwrite",
    "value": false,
    "name": "{Definition}IsVariant"
}
  • Removing the {Definition}To{Definition}Variant member breaks the link between the variant and its original entity.
  • Overwriting the {Definition}IsVariant member with the value false removes the variant status from the entity variant.

[!NOTE The configuration example describes in more detail how to configure the detach variant copy profile.

Disable variants

To disable the Variants functionality, on the target entity definition:

  1. On the menu bar, click Manage .
  2. On the Manage page, click Schema, then select the target entity definition.
  3. At the top of the entity definition page, click Actions , and then click Enable/Disable.
  4. In the Enable/Disable dialog box, turn off the Variants switch .
  5. Click Done.

When you disable the Variants functionality:

  • The Create variant and Overwrite values operations are removed.
  • Schema changes remain ({Definition}To{Definition}Variant and {Definition}IsVariant members stay in the definition).
  • Copy profiles remain.
  • Existing variants remain.
  • Variant detail pages remain.

Out-of-the-box variants

Sitecore Content Hub™ offers an out-of-the-box localization variant in Sitecore Content Marketing Platform (CMP)™ and Sitecore Marketing Resource Management (MRM)™ modules.

Localization, Detach from original, and View variants operations are available from content and resources pages. Dedicated copy profiles for these operations are also directly available.

Export variant-related entities

You can export variant entities from a source environment and import them into a target one using the import/export feature.

To export/import a schema containing variant entities:

  1. On your source environment, create and download an export package containing the variant-enabled entity definitions.
  2. On the target environment, import the export package.
  3. On the target environment, enable variants on the imported entity definitions.
  4. On the source environment, create another export package containing the remaining entities.
  5. On the target environment, import the export package.

Can we improve this article ? Provide feedback