Archief

Dev

Alternate shapes in Orchard

Orchard has a really nice way of creating your own rendering of a page, part, field or widget, called Alternates. I use it extensively in my projects, but I missed one crucial detail.

When you create an alternate for Content.cshtml that doesn’t specify a DisplayType, it gets used for every DisplayType. So in my site I created a Content-Country.cshtml, and from then on the Content module in the CMS looked really awkward. That’s because I wrote my file to be used in the front-end, but it was also being used as AdminSummary displaytype.

So, when you create an alternate for Content.cshtml, always include a displaytype! The possible displaytypes are:

And so, I renamed my Content-Country.cshtml to Content-Country.Detail.cshtml :)

#orchard #alternates #shapes