Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Renderings and Sublayouts in Sitecore

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.

like image 250
Tim Griffiths Avatar asked Apr 07 '14 13:04

Tim Griffiths


People also ask

What are sitecore renderings?

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.

What is view rendering?

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 ( .

What are Sublayouts in Sitecore?

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.


1 Answers

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

like image 134
Sean Holmesby Avatar answered Oct 02 '22 15:10

Sean Holmesby