Sitecore Rendering Parameters Best Practices – Part One

Vasiliy Fomichev

In Development Posted

Sitecore Rendering ParametersSitecore uses presentation layer Renderings and Sublayouts to present content. These presentation components are very flexible and allow Sitecore developers to either render content from the context item, the item the control is assigned to, or from another source specified programmatically or using the rendering’s Datasource property. While the content to be presented is stored in items’ fields, it is advised to store presentation layer settings in renderings’ Parameters. The only issue is that the Parameters section uses free text entry fields, which is wrong in more ways than using XSLT for renderings.


Where do rendering content and settings go?

While we are talking about what data should be stored on items versus in the rendering parameters, let’s define exactly what should go where –

  • Content relevant to the context item, should be hosted on the item carrying the rendering
  • External content should be accessed using the Datasource property of renderings
  • Rendering settings should be placed into the rendering Parameters (page size, alignment, enabling and disabling features…etc.)

Sitecore Parameters Section Issues

For instance, let’s assume we are tasked with creating a blog roll, showing a list of posts. The blog roll must have the ability to select a featured article, which would be displayed at the top of the blog, and the roll’s pages must be limited to 25 items. Each post listing item should have a title, thumbnail image, which should be aligned to the left or right, and a short summary. The page size and thumbnail alignment should be controlled by content editors. Let’s see how that would play out in Sitecore:

  • Featured article is part of the content, therefore, the selection control should be hosted on the page item
  • The Datasource field of the rendering should point to the list of news article in content or host a query for getting them
  • Page count and thumbnail alignment being a simple setting for the blog roll, should be placed as one of the rendering Parameters

So far, so good. We have created a blog roll component as described below, but problems start occurring when Content Editors try changing the page size or thumbnail alignment. Thankfully, we are dealing with an experienced editor, who paid attention during Sitecore training, and was able to find the settings in Parameters section of our new rendering. However, at this point she would have a whole list of questions: what is the minimum and maximum page size? Is it possible to show all posts on one page? … and things get worse when she gets to the thumbnail alignment – should the parameter value be capitalized? Is there a middle option (yes, it really did cross her mind)? And wait till she misspells it and claims the “website does not work”.

As you can imagine there is a whole lot of problems that can be encountered in the free-text entry world, that cause anxiety and overall bad experience for Content Editors. I have even seen developers placing paths and Ids into parameter variables (I truly feel sorry for editors that have to deal with that nonsense!)

In Sitecore Rendering Parameters Done Right – Part Two, we will look at how to properly implement rendering parameters.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.