SharePoint Variations – The complete Guide – Part 7 – Variation Hierarchy Creation

Overview

In order to create the hierarchies you first need to configure the variation labels, which should be spawned. At least the source Variation Label has to be configured in order to create the hierarchies.

Important: The creation of the hierarchies will fail if a site exists inside the Variation root site with the same name as one of the variation labels, which is about to be spawned.

 

The Create Hierarchies button in the UI will create a Scheduled Work Item in the Content Database of the site collection which is later retrieved by the CreateVariationHierarchiesJobDefinition timer job to do the actual creation of the hierarchy.

 

Per default, the timer job is configured to run once a day between 12 AM and 3 AM – that means a user will usually have to wait until the next day for the hierarchy creation to happen.

Alternatively, a farm administrator can run the job manually at any given time from the central admin site.

 

What happens during Timer Job execution?

Source variation and target variation top sites are always created one level below the variation root site. Each variation top site is using the site template configured when defining the source variation label.

To change the look and feel between the different top sites you can either use a different theme and/or a different master page.

When the variations hierarchy is first created, only the variation top sites are created. Afterwards you can create the sub sites in the variation source hierarchy. Variants of these sites are then created in the target labels – either automatically or manually.

If sites or pages are created directly in a target label, they will not be part of the variation hierarchy and content in these sites and pages will be independent from other labels.

If a new label is added to the variation hierarchy after the variations hierarchy of the source label has been first created, a new top variation site is created for the new label and in addition, (default setting) pages and sites in the source label are automatically variated to the new label.

Creating the variation hierarchy involved three major steps:

  1. Create the VariationRoot.aspx landing page which contains the logic to redirect to the different label and configure this page as welcome page for the Variation Root site
  1. Create the Variation Top site for the source variation label underneath the Variation Root site
  2. Replicate the site structure and the publishing pages from the Source Variation label to new configured target and not yet spawned variation labels

Here are more details about the three steps:

 

Configuring the Variation landing page

The Timer Job first verifies if a page with name VariationRoot.aspx exists in the Pages library of the Variation root site.

If this is not the case, it will create, check-in, publish and approve a new Publishing Page at this location based on the VariationRootPageLayout.aspx page layout, which is part of the SharePoint Server Publishing Infrastructure feature.

The last step is to configure the VariationRoot.aspx page as welcome page for the variation root site.

 

Creating the Variation Top site for the source variation label

The Timer Job first verifies if the top site of the source label already exists and will skip the rest of the steps if yes.

After checking that the top site does not exist, it will disable the automatic spawning of new created sites to the target labels to ensure that the Timer Job responsible to perform the site spawning does not pick up the new site while the hierarchy is not fully created.

The next step is to provision a new publishing site based on site template, locale and language configured in the variation settings. The title of the site will be the configured display name of the variation label.

The new site will then be marked as being a member of the variation hierarchy and a new entry for the site is created in the global Relationships List.

Afterwards the new site is configured as variation top site of the label and the hierarchy of the label will be marked as created.

The final step is to re-enable the automatic spawning of new created sites to the target labels.

 

Replicating content from source to target labels

This is the most complex step as it is possible to add new labels long after the source hierarchy is created and new sites and pages have been added to the source label it is not sufficient to just replicate the variation top site to the target labels.

Depending on the variation settings, it might be necessary to replicate the following information:

  • Just the top level sites
  • The whole site structure without pages
  • The whole site structure including all pages

The default is to replicate the whole site structure including all pages.

Here is the high-level description of how the replication is done by the timer job. Be aware that some of these operations are also performed in the other timer jobs, which are responsible to replicate only sites or pages:

For each unspawned target label, we perform the following steps:

  1. Provision the top site in the target label using the same template as on the source label using the Display Name, locale and language configured for the target label
  2. Ensure that the new site has the same configuration (variation group id, welcome page, features, navigation, UIVersion, Master page, Theme…) as the peer site in the source label
  3. The new site will then be marked as being a member of the variation hierarchy and a new entry for the site is created in the global Relationships List
  4. Pair up the pages created while provisioning the site with the equivalent items in the source site by assigning the same variation group ID to both and copy the page content from source to target label using the content deployment and migration API
  5. Recursively provision all sites that exist below the variation top site in the source label to the target label and copy all pages in the pages library using the content deployment and migration API. If required adjust the page layout of the page based on the page layout configuration for the different labels
  6. Afterwards the new top site is configured as variation top site of the label and the hierarchy of the label will be marked as created

Note: Be aware that the pages in the target label will not be a one-to-one copy of the pages in the source label. Certain field and properties will not be copied as it has to be possible to have different values in source and target. Here is a list of the fields which are not overwritten when creating/updating a page variant:

Title, Description, StartDate, EndDate, Layout, Audience, Contact, LocalContactName, LocalContactEmail, LocalContactImage, PreviousSpawnSourcePageVersion, FieldId.DocumentId, FieldId.AverageRatings, FieldId.RatingsCount

18 Comments


  1. Hi Stefan,

    I like your blog. I have a small question ( big question for me). I created a variation label with En, Hindi and Japanese languages in it. I created a page with some content in it under En and after running 'Variation Propagate Page Definition' The content is still showing in English for the variant sites instead of respective languages. Can you help me.

    Regards

    Suman P.

    Reply

  2. Hi Suman,

    The locale defines the language of the admin interface.

    Content translation is not done by Sharepoint – you need to do this yourself.

    Cheers,

    Stefan

    Reply

  3. Thank you so much for the response I got what you said but what needs to be done if I want the content also to be translated. Any other tools to do it ? Please throw some light.

    Reply

  4. Hi ,, this is a perfect topic. but I have a question.
    If I created English and Arabic variation label, how can I make who adds a content in English to be translated to Arabic, and vice versa, who adds content in Arabic to be translated to English ?

    Reply

  5. Hi,

    this is not possible. Content only flows from source label to target label. So if your source is arabic the content is propagated to the english label and can be translated here but content created in the english label will never flow to any other label.

    Cheers,
    Stefan

    Reply

  6. can I manually force it to be translated to English?

    Reply

  7. Not sure what you mean with "force". In SP2013 you can configure machine translation which uses bing translator to ensure that the content gets translated from source language to target language.

    Reply

  8. does sub site created within a source site gets replicated in target site?

    Reply

  9. Hi Shrikant,
    yes it does.
    Cheers,
    Stefan

    Reply

  10. Hi Stefan

    Do we need to do any additional configurations for subsites under a source site to get replicated into target? I created subsite and ran all the variation jobs but I don't see the subsite in target sites.

    Thanks
    Manju

    Reply

  11. Hi,
    We successfully created our site wich uses Variations.
    Also we are using custom columns that – lets say – contains some date. We would like to
    exclude this column of Variations Propagation. How can we do this. Is it possible?
    (We do not want the date to be present in the target)
    Thanks in advance
    Peter

    Reply

    1. Hi Peter,
      sorry – that is not possible out of the box.
      You could create a custom event receiver which removes the column content when the page is save on the target label.
      Cheers,
      Stefan

      Reply

  12. Hi Stefan,
    Thanks for awesome article.
    I would like to update Label Contact under Target Label Behavior in Variation labels using CSOM in sharepoint 2013. COuld you please help us that how it could be achieved. basically what is field name and from where I can get the field? Thanks!!

    Reply

    1. Hi Raj,
      this should be the user configured as the owner of the top site of the variation label.
      Cheers,
      Stefan

      Reply

  13. Hi Stefan,
    We want to have multiple URls ( 30+) which eventually comes to the same site collection and render the same content. based on the incoming URL we will programmatically change the list reads out put based on content meta data.
    only thing is we should have to have different URLs for each variation and seems like it is straight forward. But our URL format would be as below. Can variation support for this use case. If so how ?
    variation 1 : http://www.foo.com
    variation 2 : http://www.boo.com
    variation 3 : http://www.example.com

    Reply

    1. Hi Arosh,
      variations only allows to create differnet variation labels inside a site collection. You cannot do it between site collections.
      Different host names are not possible within a single site collection.
      Cheers,
      Stefan

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.