Can anyone tell me the difference between Renderings and Sublayouts in Sitecore and when each should be used? And does it make any difference when you are using MVC.
I've been going through a lot of tutorials / videos recently for Sitecore and sometimes presentation is created as a Sublayout, other times it's a Rendering both of which seem to work the same when you link it to an MVC view. There must be some difference but I haven't found anything that accurately explains what it is and when you should use each one.
In Sitecore CMS, every web page is split into multiple pieces/blocks and each of these blocks are rendered/presented by different components (a piece of functionality) separately. Every component is defined with a specific purpose and a functionality.
A view rendering is the simplest Sitecore MVC rendering type. As with all presentation items in Sitecore, a view rendering consists of a definition item in Sitecore and a file on the file system. In the case of view renderings, the file is a standard Razor view ( .
In older Web Forms implementations of Sitecore, components are created using . ascx sublayout files. They act as movable, reusable components that can also be nested inside placeholders.
The difference between Renderings and Sublayouts are simply the file types that they each represent.
In WebForms, (which was the only option in Sitecore before 6.6) these are pretty much tied to the following:-
Renderings - XSLT
Sublayouts - Web Controls (.ascx files)
For MVC (Sitecore 6.6 and up), you have the Renderings for your different MVC types. The most commonly used ones are:-
Controller Rendering
View Rendering
If you're only using MVC components, then these are the ones you'd use, as Sublayouts are more for WebForms .ascx controls.
For help with these types, I'd recommend watching Martina Welander's SitecoreMVC tutorials:-
https://www.youtube.com/watch?v=i3Mwcphtz4w
https://www.youtube.com/watch?v=dW_rQp9bMmE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With