Extract metadata
When you upload a new asset, you can import file metadata into Sitecore Content Hub and map it to that asset.
You can extract metadata either by configuring the ImportMetadataConfiguration setting in the UI or by using metadata processing scripts.
The script method supports more use cases than the UI configuration, as shown in the following table:
Use case |
Metadata configuration |
Metadata processing script |
---|---|---|
Map single-value properties |
|
|
Map single-value option lists |
|
|
Map multi-value properties |
| |
Map relations or taxonomies |
|
When you upload a file, it is associated with an asset entity using a relation. Content Hub uses Exiftool to extract the metadata from the uploaded file and stores it in a new JSON file named metadata.json, which is unique to that asset.
You can view the asset metadata file on the details API endpoint: <instance_url>/api/entities/<entity_id>
. The metadata shows under renditions.
The following code snippet is an example of a metadata.json file.
{
"ExifTool:ExifToolVersion": "10.87",
"File:FileName": "powerful-logo-bg.png",
"File:FileSize": "643917",
"File:FileModifyDate": "2019:04:16 23:55:52+00:00",
"File:FileAccessDate": "2019:04:16 23:55:52+00:00",
"File:FileInodeChangeDate": "2019:04:16 23:55:52+00:00",
"File:FilePermissions": "644",
"File:FileType": "PNG",
"File:FileTypeExtension": "PNG",
"File:MIMEType": "image/png",
"PNG:ImageWidth": "1000",
"PNG:ImageHeight": "1000",
"PNG:BitDepth": "8",
"PNG:ColorType": "2",
"PNG:Compression": "0",
"PNG:Filter": "0",
"PNG:Interlace": "0",
"PNG:ProfileName": "ICC profile",
"PNG:Software": "Adobe ImageReady",
"XMP:XMPToolkit": "Adobe XMP Core 5.6-c145 79.163499, 2018/08/13-16:40:22",
"XMP:CreatorTool": "Adobe Photoshop CC 2019 (Macintosh)",
"XMP:InstanceID": "xmp.iid:CC6E1D7DE67911E897D4DA8ADD49717E",
"XMP:DocumentID": "xmp.did:CC6E1D7EE67911E897D4DA8ADD49717E",
"XMP:DerivedFromInstanceID": "xmp.iid:CC6E1D7BE67911E897D4DA8ADD49717E",
"XMP:DerivedFromDocumentID": "xmp.did:CC6E1D7CE67911E897D4DA8ADD49717E",
"Composite:ImageSize": "1000x1000",
"Composite:Megapixels": "1"
}
Both metadata import methods require the metadata.json file to map the metadata to the asset properties.