About the Search Result Title Selection Sequence

The title of an item is the first thing you see in the search results and this field has to contain something. Coveo for Sitecore determines the search result title of an item using the following sequence:

  1. The title extracted from metadata detected by the Coveo index converters:

    1. If the page item content is extracted through an HTTP request, Coveo uses the <title> element text content.

    2. If the item is a media item, Coveo uses the title metadata.

  2. The Sitecore item Title field value, provided you’re indexing this field (see About the Indexing Manager - Fields).

  3. The Sitecore item Display Name property value.

  4. The Sitecore item Name property value.

With Sitecore content items, Coveo for Sitecore works its way down in this selection sequence until it encounters a valid value. While this is technically a desirable behavior, you may need to force the choice of one or another of these values in your own installation. In such cases, a developer or an administrator needs to modify the configuration files.

With Sitecore media items, you can also force the title of the item to be a value other than the title metadata. This can be achieved by creating a mapping in your Coveo organization.

Change the Title of Content Items

The way to change the title of content items is to prevent Coveo for Sitecore from setting the title at one or multiple steps of the sequence.

As the indexing process progresses, the title of an item changes. Before indexing, the Display Name or Name properties are used. Then, at indexing time, if a Sitecore item has a field called Title, it will automatically be mapped to the Coveo field title. Finally, when the item goes through the index converter, if there’s an extracted title metadata, it’s set as the new title.

The sections below explain how to bypass steps in the sequence.

Ignore the HTML Title Metadata (1st level)

The HTML <title> element will only be read if an HTML processor with HTTP requests such as the FetchPageContent Processor or the HTMLContentInBodyWithRequestsProcessor Processor is active.

You can deactivate these processors and use the BasicHtmlContentInBodyProcessor Processor which doesn’t send an HTTP request.

Alternatively, you can exclude the <title> element from the response using the CleanHTML sub-processor with the FetchPageContent Processor (see Index Page Content With the FetchPageContentProcessor - The postProcessing Section). The HTMLContentInBodyWithRequestsProcessor processor also provides an equivalent feature (see Index With the HTMLContentInBodyWithRequestsProcessor - Option 1: Using HTML comments).

As with any major change, don’t forget to rebuild your indexes (see Coveo for Sitecore Indexing Guide).

If you don’t rebuild your indexes, your modifications will be applied to new items only.

Ignore the Title Field (2nd level)

For any Sitecore item, the title Coveo index field is automatically mapped to the title Sitecore field if it exists, as it usually does. This is a default Coveo indexing behavior: if a Coveo index field matches an item field name, they’re mapped together. Therefore, the only way to bypass this is to rename the field in Sitecore so the field names don’t match anymore.

Your website pages usually have several titles which can be used in different contexts. You could have a long title and a short title field so you can use one or the other depending on the actual room you have to display it.

Rename your title field to something similar to long title / full title so it’s bypassed by the default mappings but remains meaningful.

  1. In your Sitecore instance, open the Content Editor.

  2. In the navigation tree, navigate to the template you want to edit, and click it.

  3. In the right pane, in the Builder tab, locate the Title field and modify its name.

  4. In the ribbon, click Save.

  5. Repeat the procedure for every item template for which you want to bypass the title mapping.

  6. Rebuild your indexes (see Coveo for Sitecore Indexing Guide).

Use Name or Display Name (3rd and 4th level)

The Name property contains the actual name of the item within Sitecore while Display Name is the one used in the Sitecore Content Editor so item names are more readable. Basically, if there’s a Display Name, it will be used and if there isn’t, Coveo for Sitecore will fall back on the name of the item. If you want the latter to be chosen, remove the Display Name. See How to set Display Name for more information.

Change the Title of Media Items

You can change the value that a media item uses as its title in Coveo search results by mapping the item title field to a different property value. For example, you can create a mapping so that all PDF items appear with the Display Name value as their title in search results when a Display Name is set on the Sitecore media item.

The Sitecore item Display Name is sent to the Coveo index as the _displayname metadata. The Fields section of the Coveo Command Center lists the metadata sent automatically by Coveo for Sitecore to the Coveo index in the Coveo Special Fields template.

To create a mapping specifically for PDF items in a source so that the Sitecore item Display Name is used as the indexed item title

  1. Open the Sources page in the Coveo Administration Console.

  2. Select the source you want to create the mapping for, and select More > Manage Mappings.

    Selecting the Manage Mapping option on a source
  3. In the Edit the Mappings of a Source panel, select the Specific tab.

  4. Select Add > Item Type in the upper-right corner of the panel.

  5. In the Add an Item Type panel, type pdf in the Filter field, and then press Enter.

    Adding the pdf item type

    For help on determining the item type value to use for a given file type, see Find the Source Item Type Values.

  6. Click Add type.

  7. In the Edit the Mappings of a Source panel, select Add > Mapping in the upper-right corner.

  8. Configure your mapping as follows.

    • Field: title

    • Apply to: Specific item types > pdf

    • Rules: %[_displayname]

      See Mapping Rule Syntax for more rule examples.

  9. Click Apply Mapping.

  10. In the Edit the Mappings of a Source panel, click Save.

  11. In your Sitecore instance, perform an indexing action on your media items.

If you now open your source in the Content Browser, your PDF media items should show the Display Name as their title, for all items where a Display Name has been specified.

What's Next for Me?