Creating a Field With an HTML Meta Tag

You can add metadata from HTML <meta> tags to the indexed items of a Web source. After creating a field for each tag keyed with either the name or property attributes, you can use mappings to fill those fields with the related content property of the tag.

You have a meta tag (<meta name="MyCustomMetaName" content="...">) in your HTML item and you want the content attribute value to be set in a field on your item. Therefore, you create a field named MyCustomMetaName and create a mapping that fills the field with the content attribute value of the meta tag.

To create a field with an HTML meta tag

  1. If not already done, create a Web source (see Add/Edit Web Source - Panel).

  2. Create a field to be used by your Web source using one of the two following configurations (see Add/Edit a Field: [FieldName] - Panel):

    • Name: MyCustomMetaName

    • Description: (empty)

      OR

    • Name: Any other name (e.g., foobar)

    • Description: MyCustomMetaName

  3. Create a mapping in which you enter the name of the metadata used as a source for the field you just created (see Edit the Mappings of a Source: [SourceName]).

  4. Rebuild your Web source to re-index the its items.

    The Web source crawler looks in the extracted item metadata to find a metadata with the name you specify in the mapping (see step 3). If the metadata exists on the item, the crawler fills the field value with the metadata value.

    However, if the metadata does not exists, the crawler try to find a metadata with the field name (see step 2). If a metadata with the field name exists, the crawler fills the field value with the metadata value.

  5. In the Content Browser, ensure the field is filled with the metadata extracted from the item (see Inspect Search Result Items).

What’s Next?

When you use a Coveo JavaScript Search interface, ensure the result list requests the field: