Change the Image tag attribute mapping in Sitecore

Current version: 5.0

By default, when you click Select in the Insert from DAM pop up, Sitecore generates an Image tag in the Image field.

Choose file to insert pop-up in the Insert from Sitecore DAM dialog box
Image field with generated image tag in the Data section of a content hub item

However, you can configure different attribute mappings on the DAM Image tag attribute. You can add as many attribute mappings as you want.

Add a new attribute mapping

To add a new attribute mapping:

  1. In the Content Editor, navigate to the /sitecore/system/Modules/DAM/Config/Mapping folder.

  2. Right-click on the folder, click Insert, and then click Attribute. Enter the name for the new item, for example, Title.

  3. On the Content tab, in the Data section, fill out the following fields:

    Field

    Content

    Content Hub Property

    The name of the property on the M.Asset entity in Content Hub

    Sitecore Attribute

    The attribute name in the Sitecore Image tag

    Note

    The value in the Sitecore attribute field must follow XML attribute standards. Special characters, such as empty spaces or white spaces, are not allowed.

  4. Click Save.

  5. To help select the property from the structure in Sitecore Content Hub, open a browser tab and enter the URL for the M.Asset entity, for example, https://<your content hub URL>/api/entities/9782.

    Note

    In the example URL, replace 9782 with the ID of the entity you have selected.

  6. The browser shows the content hub property in JSON, for example, Title:

    Example of content hub attribute properties displayed in JSON format
    Note

    If you use multilevel properties, for example, "Description":{"en-us"...}, you must add the property name in the Content Hub Property field in Step 3 as, for example, Description.en-us.

Edit an existing attribute mapping

To edit an existing attribute mapping:

  1. In the Content Editor, navigate to the /sitecore/system/Modules/DAM/Config/Mapping folder.

  2. Select the attribute you want to change, for example, the Alternative item. On the Content tab, in the Data section, for example, set the Content Hub Property field to Filename:

    Definition section on a DAM mapping item showing the Content hub attribute field set to Filename.
  3. Click Save.

Do you have some feedback for us?

If you have suggestions for improving this article,