THIS IS ARCHIVED DOCUMENTATION

Understanding the 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. In Coveo for Sitecore, this field is populated using the following sequence:

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

    1. If the page item content is extracted through an HTTP request, the title is extracted from the page <title></title> element.

    2. If the item is a media, then the title metadata.

  2. The Sitecore item Title field value, provided you’re indexing this field (see Specifying which Fields to Index).

  3. Sitecore item display name property value.

  4. Sitecore item name property value.

This selection sequence is in place to make sure that every item in the index has a title to render in the search results. If the first one is unavailable, the sequence selects the second one and so on until there are no more steps or until it encounters a valid value. While this is technically a very desirable behavior, you may need to force the choice of one or another of these values in your own installation. There’s no easy, UI-powered way to achieve that and a developer or an administrator needs to modify the configuration files in order to force the selection of a specific title.

Bypassing Specific Steps of the Sequence

Each of the values in the sequence is populated at different stages of the indexing process. Before indexing, the properties display name and name can be set within Sitecore. Then, at indexing time, if a Sitecore item has a field called Title , it will automatically be mapped to the Coveo field title. Then, when the item goes through the index converter, if there’s an extracted title metadata, it’s set as the new title. The three sections below explain how to bypass each one of the steps in the sequence.

To bypass a step, you must also implement the solutions to bypass the previous steps .

Ignoring the HTML Title Metadata (1st level)

The HTML <title></title> element will only be read if an HTML processor with HTTP requests such as the FetchPageContent Processor or HTML Content In Body With Requests Processors is active.

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

Alternatively, you can exclude the title element from the response:

Example: Here is an example for the HtmlContentInBodyWithRequestsProcessor.

Coveo.SearchProvider.Custom.config

<processor type="Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor, Coveo.SearchProviderBase">
  <StartCommentText>BEGIN NOINDEX</StartCommentText>
  <EndCommentText>END NOINDEX</EndCommentText>
</processor>

Once you configured your processor properly, you can wrap the title element with HTML comments in your layout HTML files.

ItemHTML.aspx

<head>
  <!-- BEGIN NOINDEX -->
  <title>Welcome to Sitecore</title>
  <!-- END NOINDEX -->
</head>

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.

Ignoring 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 no longer match.

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 along the lines of 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).

Using display name or name (3rd and 4th levels)

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’s not, Coveo for Sitecore will fallback on the name of the item. If you want the latter to be chosen, remove the display name (see How to set display name).

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

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

    1. If the page item content is extracted through an HTTP request, the title is extracted from the page <title></title> element.

    2. If the item is a media, then the title metadata.

  2. Sitecore item display name property value.

  3. Sitecore item name property value.

This selection sequence is in place to make sure that every item in the index has a title to render in the search results. If the first one is unavailable, the sequence selects the second one and so on until there are no more steps or until it encounters a valid value. While this is technically a very desirable behavior, you may need to force the choice of one or another of these values in your own installation. There’s no easy, UI-powered way to achieve that and a developer or an administrator needs to modify the configuration files in order to force the selection of a specific title.

Bypassing Specific Steps of the Sequence

Each of the values in the sequence is populated at different stages of the indexing process. Before indexing, the properties display name and name can be set within Sitecore. Then, 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 each one of the steps in the sequence.

To bypass a step, you must also implement the solutions to bypass the previous steps.

Ignoring the HTML Title Metadata (1st level)

The HTML <title></title> element will only be read if an HTML processor with HTTP requests such as the FetchPageContent Processor or HTML Content In Body With Requests Processors is active.

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

Alternatively, you can exclude the title element from the response:

Example: Here is an example for the HtmlContentInBodyWithRequestsProcessor.

Coveo.SearchProvider.Custom.config

<processor type="Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor, Coveo.SearchProviderBase">
  <StartCommentText>BEGIN NOINDEX</StartCommentText>
  <EndCommentText>END NOINDEX</EndCommentText>
</processor>

Once you configured your processor properly, you can wrap the title element with HTML comments in your layout HTML files.

ItemHTML.aspx

<head>
  <!-- BEGIN NOINDEX -->
  <title>Welcome to Sitecore</title>
  <!-- END NOINDEX -->
</head>

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.

Using display name or name (2nd and 3rd levels)

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’s not, Coveo for Sitecore will fallback on the name of the item. If you want the latter to be chosen, remove the display name (see How to set display name).