To branch or not to branch? Part II

In my previous post we talked about the major purpose for which the branch templates were originally invented: create different kinds of hierarchies in one click.

We covered one of the cases: page hierarchy. Now let’s have a look at another case.

Renderings Hierarchy (Case II)

Another type of the hierarchy that is often created in Sitecore is a hierarchy of renderings. When you are creating multiple identical pages for your products, articles, etc., what you are actually doing is reproducing the same hierarchy multiple times.

Let’s have a look at the example. The pages below display typical product/articles pages where every page has the same structure, layout and list of renderings.

City 1

  • Lead
  • Carousel
  • Button
  • Highlight 1
  • Highlight 2

City 2

  • Lead
  • Carousel
  • Button
  • Highlight 1
  • Highlight 2

City 3

  • Lead
  • Carousel
  • Button
  • Highlight 1
  • Highlight 2

As you can see, the renderings above create a hierarchy under the page, making the case ideal for the branch.

So, when you create a new page using the branch template, the system will create a new item by copying the structure created under the branch. In this particular case it will be copying the page, all page fields including the layout, and all the rendering data sources stored as that page’s children. The full rendering data sources hierarchy will be recreated under the newly created page item. But…of course there is a “but” 🙂

The page renderings that are used on the page will still refer to the branch datasource. What does that mean? It means that although Sitecore automatically creates new data sources for every rendering in the new hierarchy, it does not automatically replace the the links to data sources for the newly created page.

Screen Shot 2015-11-16 at 4.18.23 PM

So, your newly created page still references the data sources that are located under the branch. Unfortunately, when that happens, Content Administrators are not notified about it in any way and might get confused when they see no changes on their pages after updating data directly in data sources. This means that Content Administrators have to remember to update data source links after creating a page from the branch template.

Sometimes developers knowing about that issue might make a change and reassign data sources automatically by creating a custom solution. This option is also available in BrainJocks SCORE by default.

But if the system does not do it for you, you can reassign the data sources:

  • Navigate to the Presentation tab->Details in the Content Editor
  • Select the Edit option for the Default layout
  • Navigate to the Controls tab
  • Select the component and click the Edit button
  • Select the new data source in the related field

As soon as this operation is finished for every component, the magic will happen: the components on the new page will not refer the original data sources and can be modified on their own. The changes will not affect the source branch item, so you can go wild.

Thus, when you need to decide when to create a branch template for pages that are similar in layout, you need to ask yourself two questions:

  • How often might the template change?
  • Should pages created out of it show changes?

When you have answers to these two questions, it all becomes easy:

  • If the page does not need to show any updates performed to the template, the branch template will be the solution. Any page created once and rarely updated is a perfect candidate for the branch: e.g. news articles
  • In case there is no expectation to update the template any time soon but pages need to have similar structure and unique datasources on each page, the branch will also fit.
  • If there is a page where the change to the template should propagate to all the pages, the data template is the answer.
  • If pages are updated on a regular basis and require unique data sources, use a data template but have in mind that you will have to:

* Create unique items as fields in standard values. In this case, the template will be rigid and will not allow much control for Content Admins

* OR restrain from adding renderings requiring unique data sources in the data template, and allow Content Admin add them on page level

* OR insert the default renderings into the data template. The default renderings might contain instructions on how to create a unique data source for every item.

Screen Shot 2015-10-21 at 2.58.53 PM

Now you know everything you need to know about branch templates to be able to make a decision and even bring it up for discussion with your development team. Send me a note if it was helpful or if there is anything you would like to add on branch templates.

Jena Harnitskaya

Add a Comment

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

Or request call back