Customizing search results using @Display

Topics: Writing themes
Sep 5, 2012 at 1:29 PM
Edited Sep 5, 2012 at 1:31 PM

Hi, i'm using the search module and I'm trying to customize the search results. I know I can change templates for the individual parts and control content and order using the

I need some control over, for instance, adding 2 parts (say title and publication date) to a containing div. Can't figure out how to do this!

Using @Display(Model.searchResult) prints everything defined in placement info. I know I can remove this call and do the rendering myself. I'm fine with that, but is it possible to do something like this


I want to use the templates I already have, but control the containing HTML.

Hope my question is clear and thanx in advance!

ps: I can't really find good documentation on the display method. Neither on the 'wrapper' concept, which might have something to do with this (yes, i'm new to Orchard ;-)

Sep 12, 2012 at 10:06 PM

Display is for rendering shapes, not content parts. You should read this:

Sep 13, 2012 at 7:04 AM
Edited Sep 13, 2012 at 7:05 AM

Hi bertrand, 

I found that post and indeed use the shapehelper to do this, although it feels a bit 'hacky'. Also there are limitations like differentiating between two image fields (which you can do with placement). I understand it needs shapes, In Orchard-learning-curve-days, the post above is ancient ;-)

However, in your blog you present this as a alternative to placement info, but as far as I can tell there is no way to do this with placement.


<div id="justifyparts">
<div class="content">body</div>

The key issue here is displaying the author and title in the same containing div. I understand alternates, theming and all that stuff to render the individual parts, but this I can't get done with placement. 

If placement would support somekind of grouping with the option to specify a container, that would help. Another option would be some sort of microzones, where I can define a layout at the contentitem level and use to render it in a certain microzone

Ofcourse, there's always the possibility I'm completely missing something here

Sep 13, 2012 at 7:01 PM

No, you're absolutely right. This is why I open that bug a while ago: Please vote it up.

Sep 13, 2012 at 8:31 PM

Done, would be a create addition to Archard.

A bit off topic: Is there alot of community contribution for these release plannings? From what I understand Orchard is an open source Microsoft project, so do they have a dedicated team coordinating and developing, or was it created and then released to the community? I see a couple of names recurring everywhere (mainly you and sebastian).

Is the Trello board open for viewing?

Sep 14, 2012 at 1:34 AM

No, it's not an open source Microsoft project. It's an open source project that happens to have been started by Microsoft, and to which Microsoft is contributing dev resources. The governance of the project is 80% non-Microsoft, through an elected steering committee. I do not work for Microsoft. The Trello board is open for viewing, yes.