Sitecore 8.2+ Multi-site Shared Placeholders and Cascade Renderings

This post is based on setting up the home item (or another item) with the needed presentation and letting it cascade to all the pages under it in a multi-site Sitecore solution. At first, we tried using the cascade renderings which works great but at some point it becomes hard to manage with each rendering having the cascade flag.

What if, we setup the Home item with the presentation we need cascaded in a specific placeholders and the code takes care of the rest. Tim Braga at SUGCON Europe 2016 had a talk about Atomic Design which led to a conversation with Kam Figy (the fake Kam). I looked for code and my good friend Google got me to a blog post by Tom Dudfield.

Following which we came up with the requirements:

  1. Setup one or more placeholders where we can set the presentation on the home item of a multi-site Sitecore solution.
  2. Add or remove placeholders as we wish
  3. Execute it in the context on specific databases (master, web, prod, etc)
  4. Execute this on specific item templates
  5. Exclude certain renderings from certain pages

Once we had the requirements we went to code. Having existing code helped a ton but making it generic and to be able to control as per the requirements needed some work.

Currently we use it for cascading the header and footer sections on our sites.  A version of this code currently is running on our production systems and has not given us any issue.

Please be ware that modules such as Sitecore.Boost rely on the same processors as this code does. I would suggest coordinating with the module creators and wrapping their code as part of yours.

If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).

2 comments

Add your comment

Your email address will not be published.