Is there a recommended approach to creating a Search Results in SXA that have different renderings for different content types? The use case would be something like this:

There are 3 content types,

  • Page - default from SXA with Title and Content fields
  • News - inherits from Page, adds Published Date datetime field
  • Author - inherits from Page, adds Profile Picture image field

There is a single site wide search page, the result set could contain all the above item types. Using Rendering Variants, all the fields, from all the templates can be listed under a new variant, however this adds some constraints to how you can order all of the fields, as well as becoming confusing if when trying to figure out which field is for which template.

I have built similar functionality outside of the SXA context which usually ends up having some sort of TemplateID/TemplateName to Controller/View/Model mapping, either in Sitecore or Config files.

In this case, I'd like the results page to use as much of the out-of-the-box SXA search components as possible.

2 Answers 2


At the moment SXA doesn't support such kinds of mapping. I would recommend to go with Rendering Variants. You can create one rendering variant which will have following fields:

  • Title
  • Content
  • Published Date
  • Profile Picture

Rendering variants won't render fields which don't exist so Published Date and Profile Picture will be only shown if items of News or Author templates will be found.

Regarding sorting:

  • you can choose default sort order in the Search Results rendering properties
  • add Sort Results component which can be configured to use pre-defined sorting options which are stored here: SITE/Data/Search/Sort Results

The best solution I've found so far for this is to use a single rendering variant with different sections that contain the fields for different templates.

Each section then has Rules applied to determine whether it should be rendered and I've based the rules on matching specific templates or template inheritance.

  • 3
    Welcome to SSE, Tony. While your solution may be valid, your answer here is very short and lacking in detail. Please consider editing your answer to add more explicit instructions and examples.
    – Ben Golden
    Feb 20, 2018 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.