I've noticed that in /sitecore/layout there is a Controllers folder (first item underneath actually). In that folder you can add items of type Controller. These items have fields for a controller name and action name, so they seem to map to some mvc code.

I did check the links of the template and noticed one usage (/sitecore/system/Settings/Rules/Insert Options/Rules/MVC Controllers) but this rule is for setting insert options on the folders in the Controllers section in Layouts.

So, my question is: what is the purpose of these items? How could I use them? And why?


I think it's just another way of creating Controller rendering, You basically create Controller item (Of template /sitecore/templates/System/Layout/Controller) and enter the Controller Name (YourNamespace.ControllerClassName) and Controller Action (default is index if blank), Then when you create your controller rendering item you enter the Controller item name that you created previously in Controller field, and you leave Controller Action field empty.

It does not really give you that much of a benefit unless you think it helps to separate all of your controller definitions in that Controllers folder, and then reference it from the controller renderings in renderings folder

| improve this answer | |
  • 1
    I agree. I've been thinking about the reasoning - to answer the "why" part of the question. I think this way of setting it up makes sense, if you have a "bundle" of action methods on one controller - for a series of variations of a simple rendering. Like e.g. on a CarouselController, which then would have index methods for VideoSlide, ImageSlide, HeroSlide and so on. By mapping it to a common "Controller" like this - you would only have 1 place in your solution to go and change, if the namespacing/assembly changed - as opposed to editing 6 controller rendering items. – Mark Cassidy Dec 21 '17 at 23:48
  • 2
    I left a comment on this previous post, there are too many things missing from the template that it doesn't fit with the Sitecore way of doing things - Parameters template, Datasource Location, Template, Compatible Renderings, Caching etc. so I don't believe it is a different way of Controller Renderings. Might make slightly more sense as a pointer to a controller.... – jammykam Dec 21 '17 at 23:51
  • @jammykam don't you still have to create controller rendering anyway? Where you can apply parameter template, data source etc .... – Ahmed Okour Dec 21 '17 at 23:54
  • Re-reading this and the other comment, seems like it and I may have misunderstood. Seems a little pointless... kinda like creating the model definition just to select it on your rendering item... solves the mystery at least! – jammykam Dec 21 '17 at 23:58
  • 1
    I can't find any source material to confirm this. But @mdresser blogged about it here: matthewdresser.com/sitecore/sitecore-mvc-presentation-concepts – Mark Cassidy Dec 22 '17 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.