Rule Placeholders

James Grergory James Gregory | January 05, 2018 Comments

Decouple Placeholder Management with Allowed Rendering Rules

The best Sitecore solutions I’ve seen use component driven design. This eases future maintenance and gives a plug-n-play feel where you can add or remove modular, well-defined features. Sitecore’s well-documented Helix principles and the community’s adoption has greatly encouraged this design practice.

However, every once in a while I run into a conflict on placeholder setting items. Let’s say one module introduces a placeholder, then another module, or even the site implementation, wants to add an allowed rendering for that placeholder. In order to make this configuration, you are coupling the modules or rigging it just for this implementation. I ran into this lately when using SXA, and wanting to add a custom rendering to the SXA mvc form placeholder. If I edit the SXA placeholder definition item, I risk having it undone with the next SXA upgrade and I doubt anyone will notice except for the authors that are left scratching their heads!

Sitecore’s insert option rules have expertly resolved these sorts of issues for me in the past in regards to insert options between modules, and they were the inspiration behind extending placeholder management in a similar way. Below is a link to the latest Sitecore Package and source code. Mimicking insert option rules, I added a place under /sitecore/system/settings/rules for Placeholders and provided matching conditions and actions to add, and even remove, allowed components for placeholders. This works to show or hide components from the add component dialog for any placeholder. The rule is evaluated after all the normal configuration in the getPlaceholderRenderings pipeline.

I’ve enjoyed the separation of concerns this provides. I hope you can find it useful too!

GitHub Release (

Screenshots (

Contact Us Today!

Write a review


  • Jameson WordPress Expert
  • Steven LaGow Blog Author
  • John Parker
  • James Grergory
  • Ellis LaMay Blog Author Image
  • Mani Blogger Image
  • Elin-Alexander
  • David-Dillon
  • Ahmed Okour
  • Paul-Ross-Blogger-Bio-Pic
  • Rachel-B-Web
  • Courtney-V4
  • scottstiles
  • stu-3
  • Joseph Gustafson
  • Vince Scarlata
  • Tim Ahlenius
  • Staff Blogs
  • shawn griffin blogger image
  • Americaneagle Partner
  • Nick Goodrum
  • Missy Hildebrand
  • corte-swearingen-director-ab-testing
  • Emily Stark