Dusty Eves

dusty.eves@techno-babble.net

Sitecore Architect with Paragon Consulting

Sitecore Item Renderings

The Lost and Forgotten Rendering

Since Sitecore MVC was introduced we added Controller and View renderings to our back of tricks.  In that same bag of tricks was Item renderings.  Far less popular than it’s siblings, Item renderings sits in the background unnoticed.  While poorly suited to replace its more famous brothers, Item renderings brings some things to the party that it’s older brothers do not.

How Item Renderings Work

Conceptually, Item renderings invert Sitecore’s typical presentation model.  Normally the logical flow is a presentation component is selected and either renders the Sitecore context item or render’s it data source item, an item rendering does the opposite.  This requires or assumes compatibility between the rendering and the item type.  Item renderings invert the logic.  For an item rendering and item is selected and that item definition has knowledge of how to render itself.

To illustrate, let’s compare the rendering setup using a View rendering an an item rendering.

Below we have a Promo template, and a PromoCalloutView rendering that consumes it, and a rendering details for an item making use of it:

Item-Rendering-View-Rendering-Setup

This represents a typical setup for a view rendering.  And below we have the same results via an item rendering:

ItemRendering--ItemRenderingPresentationSetup

In the case of the item rendering, the presentation details only hold what item is rendered, and the item itself stores the how of the rendering.  While not better in all scenarios than a view rendering, this has an advantage over controller or view renderings in Sitecore Personalization.  Personalization rules often take the form of: If condition [x] is met, change the data source of the rendering to [y].  In this scenario the component doing the rendering remains the same.  This limits how much different the personalization can differ from the rendering as the renderer is determined in the presentation.  In the case of an item rendering, as the definition is on the item itself the personalization can be as different as any two renderings.