Creating a Field With an HTML Meta Tag

As a member of the Administrators or Content Managers built-in groups, 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 these 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. Create a field named MyCustomMetaName and create a mapping that fills this field with the content attribute value of the meta tag.

To create a field with an HTML meta tag

  1. Create a Web source, if not already done.

  2. Create a field to be used by your Web source, using one of the two following configurations:

    • 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.

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

    The Web source crawler looks in the extracted item metadata to find 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 doesn’t exist, the crawler tries to find metadata with the field name (see step 2). If metadata with the field name exists, the crawler fills the field value with the metadata value.

  5. On the Content Browser page, ensure that 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 that the result list requests the field:

Recommended Articles