Interpreting item body as an HTML item
Interpreting item body as an HTML item
When indexing an item in your Coveo organization, that item must go through the mapping stage of the indexing pipeline process. At this stage, the item metadata is associated with fields in your index.
The mapping process is similar for the body of an item (that is, actual content) which is mapped to the body
field whenever possible.
When analyzing your items through the Content Browser or from your search interface, you may find occurrences where an item excerpt and Quick view display HTML tags that come from the original repository document such as a web page, file, database record, or Salesforce object.
You can get rid of these HTML tags by applying a mapping rule that will cause the item body to be interpreted as an HTML document.
Depending on your needs, you may want to interpret each item in a source as HTML, or to interpret a subset of items in a source as HTML.
Using the following procedures modifies the default mapping behavior of the |
Interpreting each item in a source as HTML
-
In the Coveo Administration Console, access the Edit mappings panel, and then, select the Common tab.
-
In the Edit mappings panel, click the Field dropdown menu, and then select the
body
field (that is,spobody
in a SharePoint Online source). -
In the panel that appears:
-
Under Rules, enclose the
%[metadataName]
placeholder withhtml/body
tags as follows:<html><body>%[metadataName]</body></html>
-
Click Save.
ExampleTo fill the
[metadataName]
placeholder with thedescription
metadata, you create a mapping as follows:Field:
body
Apply to:
All items (common)
Rules:
<html><body>%[description]</body></html>
-
-
Back in the Edit mappings panel, click Save and rebuild source.
Once the source rebuild process is complete, HTML tags originally appearing in the metadata used to populate the
body
field of your source items should be interpreted as such in item excerpts and Quick views. The items should also appear as HTML files in the Content Browser (platform-ca | platform-eu | platform-au) or in your search interface.
Coveo crawlers rely on multiple fields, depending on the repository, to create the For example, your item body that contains HTML tags is filled with the values of the In order to remove the HTML tags from the item body, you create a mapping rule that maps the This action prevents the relevant data contained in the |
Interpreting a subset of items in a source as HTML
-
In the Coveo Administration Console, access the Edit mappings panel, and then, if you want to apply mapping to a subset of your source items, select the Specific tab.
-
In the upper-right corner of the Edit mappings panel, click Add, and then select Item type.
-
In the Add an Item Type panel, click the dropdown menu and then select or create the source item type (for example,
text
orarticle
) for which you want the mapping to apply, and then click Add type. -
In the upper-right corner of the Edit mappings panel, click Add, and then select Mapping.
-
In the panel that appears:
-
Under Field, select the
body
field (that is,spobody
in a SharePoint Online source).The
body
field is named differently in each source, but most of the time it containsbody
in its display name. -
Under Apply to, select the Specific item types radio button, and then select the source item types for which you want the mapping to apply.
-
Under Rules, enclose the
%[metadataName]
placeholder withhtml/body
tags as follows:<html><body>%[metadataName]</body></html>
NoteIn this procedure, the
[metadataName]
placeholder is filled with thedescription
metadata. -
Click Apply mapping
-
-
Back in the Edit mappings panel, click Save and rebuild source.
Items matching the selected source item type (from step 3) should no longer display HTML tags. The items should also appear as HTML files in the Content Browser (platform-ca | platform-eu | platform-au) or in your search interface.
Coveo crawlers rely on multiple fields, depending on the repository, to create the For example, your item body that contains HTML tags is filled with the values of the In order to remove the HTML tags from the item body, you create a mapping rule that maps the This action prevents the relevant data contained in the |