Coveo Item Result Template

Warning
Legacy feature

This article pertains to the Coveo Hive framework which is now in maintenance mode.

Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details.

Coveo for Sitecore Specific Rendering Provides a Coveo JavaScript Search Framework Underscore.js result template for Coveo Results List and Coveo Omnibox Result List renderings using a field value set on the data source item.

Usage notes

  • The field must contain valid HTML that would usually be included in a <script> tag in a usual Coveo JavaScript Search Framework implementation.

  • For more result template content details and examples, refer to the Edit the Content of a Result Template article.

  • Typical search interface result sections contain several result template renderings (whether Coveo Item Result Template renderings, Coveo File Result Template renderings, or a combination of both) with conditions that determine the template a result item will use. The order of your result template renderings in the Result Templates placeholder is important (see Result Template Conditions).

Insertion location

Coveo Hive

The Coveo Item Result Template rendering is an Allowed Control in the following placeholder(s): Result Templates

Example insertion sequence for the Coveo Item Result Template rendering.

Coveo Hive SXA

When you add the Coveo Results List SXA rendering, this adds a coveouiresulttemplatessxa placeholder. Insert your Coveo Item Result Template renderings in this coveouiresulttemplatessxa placeholder.

Example insertion sequence for the Coveo Item Result Template rendering.

Data source options

The following table lists the available data source options for this rendering.

Option name Description

Script

The HTML of the result template (see Coveo Item Result Template).

Display in mobile mode

Defines whether to show the template when the user is in mobile mode.

Display in tablet mode

Defines whether to show the template when the user is in tablet mode.

Display in desktop mode

Defines whether to show the template when the user is in desktop mode.

Result layout

Defines whether the template should only be used only in a Card layout, only in a List layout, or in both.

Template based conditions

Specifies the Sitecore templates that will use this result template.

Field value based conditions

Specifies Coveo field name and value conditions a search result must meet, in addition to the template-based conditions, for this result template to be used.

DOM unique ID

Randomly generated HTML element ID.

Sample generated HTML and corresponding visual output

Consider a situation where you create separate result templates for each of your Sitecore templates. Using a Template based condition in one of your Coveo Item Result Template rendering data sources, the rendering would generate outputs similar to the following.

<script id="coveo5e882470" class="result-template" type="text/x-underscore-template"
data-prebind-sc-all-conditions="unfoldDictionaryToAttributesPrebind"
data-sc-all-conditions="{&quot;_template&quot; : &quot;311337FF57ED447B86B18BDFA5DBDC82&quot;}"
data-applied-prebind="true" data-field-z95xtemplate="311337FF57ED447B86B18BDFA5DBDC82">
<!-- beginning of the content entered in the Script field of the data source -->++++++
  <div style="padding: 5px; background-color:powderblue;">
    <div class="my-result-template-header" style="display: flex; align-items: center;">
      <div class="CoveoIcon" data-small="true"></div>
      <div class="CoveoResultLink" data-field="{{= coveoFieldName("@title") }}"
        style="flex-grow: 1; margin-left: 5px;"></div>
    </div>
    <div class="my-result-template-content">
      <div class="CoveoExcerpt"></div>
    </div>
  </div>++++++
<!-- end of the content entered in the Script field of the data source -->
</script>
Result templates Versus Conditions | Coveo for Sitecore 5