How to specify alternate layout for a content type

Topics: Customizing Orchard, General
May 23, 2013 at 3:15 PM
Hi,

Is there someway to specify a alternate layout for content types? I know there are ways of assigning alternate layouts for urls but it would be great if there was a way to apply a layout to all items of a specific content type.

Thanks for the help.
Developer
May 23, 2013 at 3:25 PM
Not out of the box as far as I know. Generating an alternate for Layout based on content type means that you need to decide what the current content item is and use its content type to generate an alternate. A page can potentially render more than one content item, but you are most likely referring to the content item being rendered as a result to accessing a certain url.
You could totally do that and generate an alternate for the Layout based on the content type for the currently routed content item.

I wrote an article about this a while ago: http://www.skywalkersoftwaredevelopment.net/blog/getting-the-current-content-item-in-orchard
There's probably a post somewhere explaining how to write a ShapeTableProvider from where you can add alternates.

Perhaps you're already aware of the upcoming Orchard Harvest conference, but if not, it would be a great way to learn more and meet the people behind Orchard and ask questions. http://euro2013.orchardharvest.org.