Coveo File Result Template

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 an on-disk .cshtml file.

Usage Notes

  • The Coveo File Result Template rendering data source must reference the result template .cshtml filename. Save your result template .cshtml file in the <SITECORE_INSTANCE_ROOT>\Website\Coveo\Hive\templates folder (Sitecore 8), or in the <SITECORE_INSTANCE_ROOT>\Coveo\Hive\templates folder (Sitecore 9 and 10).

  • 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 File Result Template rendering is an Allowed Control in the following placeholder(s): Result Templates

Example insertion sequence for the Coveo File Result Template rendering.

Coveo Hive SXA

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

Example insertion sequence for the Coveo File Result Template rendering.

Data Source Options

Option name Description

File template name

Filename, minus the extension, of the .cshtml result template file.

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 your Books Sitecore template items, and your Author Sitecore template items. Using a Template based condition in your Coveo File Result Template rendering data sources, each rendering would generate outputs similar to the following.

<script id="coveo9b6c6a33" class="result-template" type="text/x-underscore-template"
data-prebind-sc-all-conditions="unfoldDictionaryToAttributesPrebind"
data-sc-all-conditions="{&quot;_template&quot; : &quot;F28528EB0B724D70B476FFD9F1A169F0&quot;}"
data-applied-prebind="true" data-field-z95xtemplate="F28528EB0B724D70B476FFD9F1A169F0">
<!-- content of the .cshtml file referenced in the data source appears here -->
</script>
Result templates Versus Conditions
What's next for me?