Using Branch Presets to fix the static datasource path in the Branch Templates

We were working on one scenario where we had used Branch template and the item had presentation details (layout and renderings) applied on Standard Values where we had used Datasource (items from the hierarchy itself) on the renderings. But when we created items based on this branch template, the datasource path was still pointing to Branch template one.

I will quickly show the scenario using screenshot.

  1. $name item under Press Release branch with Presentation details using Datasource for Carousel rendering and datasource as the folder under $name.
    Branch Template with Datasource
  2. And at item level (created based on Press Release branch template) the datasource path is referring to branch template’s child.
    Item with Datasource
    The datasource path at item level should have reference to the folder under the item and not to the branch template.

While doing some R&D, we found the Branch Presets by Kamsar which came to our rescue. This solution fixes the bug we have faced.

The Steps to use the Branch Presets:

  1. Download the zip from the Github from the above link.
  2. Extract and open the solution in visual studio.
  3. Build the solution, it will fail since it is missing the reference to Sitecore.
  4. Install the Sitecore.Kernel from the Nuget packages (Select previous version (8.2.x) as the Branch Presets solution is built on 4.6 .Net framework).
  5. Build the solution again.
  6. Copy the BranchPresets.dll from bin to the Sitecore instance bin.
  7. Copy the z_Client folder to App_Config\Include folder from Sitecore instance.

And you are done. Just reload the Sitecore instance and check if the datasource path is fixed.
Item with Datasource 1

Thank you.. Keep Learning.. Keep Sitecoring.. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s