All About Sitecore Renderings
Sitecore has an interesting nomenclature for many terms describing components on the front-end and back-end of the CMS. One area I’d like to focus is the set of presentation components displayed on the front-end of the site. The page is broken down into several layers, the outermost being the page itself. The shell of any given page is a layout which in plain ASP.NET speak is represented by a standard Web Form, an .aspx file. The purpose of a layout is to create a shell that other sub-components of the page can get applied to. Think of a layout as a blueprint or framework for the page. Once Sitecore placeholders are added to a layout, many sub-components can be added to the page. These sub-components go by the umbrella term renderings.
Types of Renderings
Rendering is an umbrella term for the following components:
- XSLT Rendering
- Web Control
Each of these rendering types has its own pros and cons and requires different coding styles to actually render content to the front-end of the site.
A sublayout is a Sitecore wrapper around a Web User Control, an .ascx in plain ASP.NET. Sublayouts are defined in Sitecore under /sitecore/content/layouts/sublayouts. Each sublayout definition contains a field for the path to the ASCX file. It also has additional default fields for DataSource, Parameters, and Caching options.
An XSLT Rendering should not be confused with the umbrella term “rendering.” An XSLT rendering is like a sublayout in that its a wrapper around an existing ASP.NET component. In this case, an XSL Transformation.
The last main type of rendering is a Web Control. A web control most closely related to a Server Control in ASP.NET. The rendered code from a web control is written in C# so web control are best used for components that require small amount of mark-up. Web Controls are powerful in that a developer can define additional Sitecore caching settings in the code. Web Controls are referenced by a namespace and assembly, so they must be compiled into a external DLL as opposed to a ASCX or XSLT.
As you can see, as a developer, you have some choices on what types of rendering to use. I personally like to use Sublayouts almost exclusively because they’re flexible enough that I can write plenty of front-end HTML and can write all of my code-behind in C#. I generally stay away from XSLT unless I’m doing breadcrumbs, which Sitecore has a module for in the Shared Source repository. Web Controls seem to be useful if you want to create your own controls that don’t have a lot of HTML to be rendered. I see this being useful for small pieces of data that you need to massage before rendering to the page.
1 Comment + Add Comment
Got anything to say? Go ahead and leave a comment!
- Using the DataSource Field with Sitecore Sublayouts
- Tame Your Sitecore Treelists
- Write to a Custom Sitecore Log with log4net
- Sitecore Upgrade Strategy
- Rendering Fully Qualified Sitecore URLs
- Sitecore Admin Pages Explained
- Managing CSS in the Sitecore Media Library
- Use Any() Instead of Count() To See if an IEnumerable Has Any Objects
- Sitecore Front-End Development Best Practices
- Scaling Sitecore Presentation Component Data Sources
- Performance tuning your Sitecore installation | Agile and ALM: Software development today on A Going Live Checklist for Sitecore Websites
- Imran Saleem on Sitecore Avanced Database Crawler Occasionally Provides Null Results
- Ty Cahill on Sitecore Front-End Development Best Practices
- Sitecore Managed Sites as Virtual Folders | Fire Breaks Ice on Sitecore Item and Field Names
- Krimos on Using the DataSource Field with Sitecore Sublayouts
- Aboo Bolaky
- Alex Shyba
- Anders Dreyer
- Brian Pedersen
- Christopher Wojciech
- Coffee => Coder => Code
- Dev Sitecored²
- Everything Web
- Image0.com blog
- John West
- Learn Sitecore
- Let's do Sitecore
- Mark van Aalst
- Matthew Kenny
- Molten Core
- Project Lifecycle
- Sean Kearney
- Sebastian Patten
- Sitecore Australia
- Sitecore Blog
- Sitecore Climber
- Sitecore Development
- Sitecore Gadgets
- The Client View
- The Sitecore Experience
- Web Content Management and Delivery