THIS IS ARCHIVED DOCUMENTATION

Step 5: Customizing Result Templates

Now that you have a search page with some basic controls, you’re ready to customize the result templates.

Result templates dictate the way that search results are displayed in your search interface. Since you don’t currently have any templates, the Coveo JavaScript Search Framework simply displays the document Title field, as well as an excerpt when the HTML was crawled at indexing time.

Coveo for Sitecore Hive provides a Default Template which you can use for a richer result list. You can find this template on the website root folder under Coveo > Hive > Templates.

Result templates leverage the Underscore library and are highly extensible.

We recommend that you create a new file instead of changing the default one when creating or modifying a result template.

For this tutorial, you’ll assign the Default template to your results.

  1. In the Sitecore Experience Editor for your search page, select the result-template placeholder. It should be just above your result list.

  2. Select Add here, and select the Coveo File Result Template.

  3. In the Select the Associated Content window, select Create New Component and choose the parent you prefer.

  4. Save your page. You should see the following error:

     Undefined Result Template. Please configure the component.
    
  5. Click on the error message, bringing you to the Coveo File Result Template controller.

  6. Open its properties by clicking the Coveo icon on the left.

  7. In the properties window, under Basic Settings > File Template Name, enter default.

  8. Select OK to save and close the properties window, and click the Save icon to save your page.

  9. Your Result Template control should show a warning since the file has not yet been specified. To solve this:

    1. Click on the Result Template control and open its properties by clicking on the Coveo button.

    2. Look for the File Template Name and type default in the input.

    3. Close the properties and save the page.

Your result list should now use your result templates.

You can add many templates in a single Result List to show different results based on different items.

You should now proceed to Step 6: Changing the Result Layout.

What's next for me?