Sitecore Customization: How to Create Custom Rendering Parameters Template

The best practice and most important approach of Sitecore development is separating responsibilities of “what to display” and “how to display”. Sitecore platform+ASP.NET MVC solution provides perfect separation between content data, function logic, and presentation experience. Sublayout and rendering in Sitecore define the content source, place holder and how the content been displayed. The parameters in rendering configuration is a very useful customization feature to allow content display in a way that user want. Here I’d like to illustrate how to create and use custom rendering parameters template. The sample shows capabilities within a Sitecore MVC solution to provide content authors the ability to customize the appearance of presentation components. The implementation of these capabilities involves configuration within Sitecore, c# code, and implementation of front end display logic to honour the configured parameters.

Instead of using rendering parameters name-value pairs, I’d like to standardize the parameters for Content Authors to avoid typo and also make configuration easier. Here is the custom rendering parameters template “Add Mobile Rendering Parameters” with two parameters built in: Show on Mobile DevicesMobile Display Style

Parameters

Change the rendering parameters template to the one created above.

Parameters3

Then configure the predefined parameters in page presentation details. Here is how the parameters been configured.

Parameters2

This is a controller rendering. Let’s add c# code in action to retrieve the parameter values. It should also work in view rendering as well.Parameters4

Based on these parameter values, the content will be showed on mobile device and rendered in scroll view style.

 

This entry was posted in Information Technology, Sitecore and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s