Sitecore best practice #4: Pick your modules carefully

03 June 2011Adam Najmanowicz

The best practice advises Sitecore CMS developers to be mindful of the modules they allow in placeholders rather than allowing every module to be placed everywhere.

While this practice may seem pretty straightforward and obvious if you do it right, not getting it employed makes the content management system feel sloppy and creates an impression that your solution is unfinished and untidy (which to be frank... in this case, it is). To add insult to injury, it's not just that some modules will not make sense in some placeholders, they will look just plain ugly there.

The solution to the problem however is well supported and strongly endorsed by Sitecore.

What is it about?

When a placeholder is put on a page, it has to be determined what modules are valid within that placeholder and the list should be narrowed so the authors can just use the required modules rather than be presented with the list of all renderings available in the system.

Why should I do it?

While designing the site, we assume that some modules can be placed only in certain chosen placeholders. The same principle concerns placeholders - some of them can contains particular modules only. The reason can be that the control does not fit with the layout of a page type, control can be too wide for the column, etc. That is why, sometimes we want to restrict the list of the allowed controls.

Demo scenario

On the homepage, we allow only summary and tweets modules to be displayed in bottom right section of the page. That is why, while adding a new control to this placeholder authors should not be presented with the option of adding other controls there:

Right Approach

Wrong Approach

How do I implement it in my project?

In Content Editor navigate to Layout -> Placeholder Settings -> chosen placeholder. Change the Allowed Controls property so only the proper modules are chosen (see screenshot):

Setting available renderings in a placeholder

Big thanks to Marek Musielak for his research and help on the Sitecore Best Practice 4.

Author: Adam Najmanowicz
Published: 03 June 2011
authoringcomponentsdigital platformssitecoretechnology

People in or team love to share their experience. Explore our blog

Job Opportunities

We're always looking for new faces to join the Cognifide family. Take a look at our available jobs.