Change the Image tag attribute mapping in Sitecore
By default, when you click Select in the Insert from DAM pop up, Sitecore generates an Image tag in the Image field.
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:
-
In the Content Editor, navigate to the /sitecore/system/Modules/DAM/Config/Mapping folder.
-
Right-click on the folder, click Insert, and then click Attribute. Enter the name for the new item, for example,
Title
. -
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 HubSitecore Attribute
The attribute name in the Sitecore Image tag
NoteThe value in the Sitecore attribute field must follow XML attribute standards. Special characters, such as empty spaces or white spaces, are not allowed.
-
Click Save.
-
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
.NoteIn the example URL, replace 9782 with the ID of the entity you have selected.
-
The browser shows the content hub property in JSON, for example,
Title
:NoteIf 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:
-
In the Content Editor, navigate to the /sitecore/system/Modules/DAM/Config/Mapping folder.
-
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:
-
Click Save.