Overriding shape template for specific module from theme

Topics: Writing themes
Apr 24, 2012 at 5:38 PM

Evidences from the localization of TheThemeMachine theme suggest that there is the ability to override shape templates (or here rather: views) for a specific module. Look for "Orchard.Tags" on the linked page: it seems that once the Home/Search.cshtml view of Orchard.Tags was overridden. This does work now too for simple views, but for other templates (e.g. display shape templates) it seems not to. Is this intended?

Apr 24, 2012 at 5:49 PM

It has always worked, by design. All templates can be overridden from themes. What did you try that didn't work?

Apr 24, 2012 at 5:52 PM
Edited Apr 24, 2012 at 5:54 PM

Well it seems it is and the answer for the question "Where can I place my override then if I want it to be module-specific?" came from an unexpected helper, from the InvalidOperationException thrown when the system can't find a template :-). It tells where it searched, so it seems that the example with Tags works because it has the controller name in its path too. So e.g. this will work too:


or also this, but this is not module-specific:


What I originally wanted, following the logic was this:


All considering that the original template is under:


Edit: thanks Bertrand, the above did the trick.