How to overwrite search results template?

Topics: Writing themes
Mar 18, 2013 at 2:46 PM
I was trying to overwrite the search results template the other day but I couldn't figure out how to do it.

The search results get rendered with the View Index.cshtml in the Module Orchard.Search/Views/Search/Index.cshtml

I tried creating an Index.cshtml file in my themes view folder, and this "works" in that it does allow to adjust the rendering of the search results. But it also breaks the backend by causing a server error on the admin home page (I suppose this uses an Index.cshtml file as well). I don't even want to know where else this would be causing trouble.

Is there a proper way to do it?
Developer
Mar 19, 2013 at 1:13 AM
Yes, in order to override views (not shapes), you need to create the following folder structure in your theme:

/Views/ModuleName/ControllerName/ViewName.cshtml

In the case of the Search module, it would look like this:

/Views/Orchard.Search/Search/Index.cshtml