What's the difference between Renderings and Sublayouts in Sitecore
Asked Answered
Q

2

9

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.

Quartz answered 7/4, 2014 at 13:33 Comment(0)
P
16

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

Purine answered 7/4, 2014 at 14:4 Comment(0)
B
1

Basically, a Sublayout is a type of Rendering.
The reason why there are two different names is mostly because of legacy:

In "the old days" you used to only have:
- Sublayouts (= Renderings that use an ASP.NET User Control)
- Renderings (= Renderings that use an XSLT file)

The two having different names has pretty much become obsolete with the introduction of MVC and the slowly dying of XSLT.
If you are using MVC, you will not use Sublayouts at all, only Renderings of which you have multiple different types.

I try to only talk about "Renderings" and not mention the different types too much as it only confuses users.

Borborygmus answered 7/4, 2014 at 14:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.