Asset metadata refers to extra data associated with assets that we upload in aem, which is used to describe an asset in more details. During migration the biggest challenge that a developer face is to migrate millions of asset with its associated metadata in aem.
In this tutorial we will see :-
- What do you mean by metadata in aem.
- What is the difference between Metadata Profiles and Metadata Schema.
- Metadata Profiles in AEM.
- Metadata Schema in AEM.
Asset metadata in aem:-
When ever we upload an asset (image, pdf, video, document etc..) in aem, aem runs its default workflow “Dam Update Asset” to create metadata for this asset and stores metadata in the form of properties on metadata node.
For example:- Lets upload an asset in aemcq5tutorials folder. Then Dam Update Asset workflow will be triggered and its metadata will be stored under /content/dam/aemcq5tutorials/jcr:content/metadata .
Difference between Metadata Profiles and Metadata Schema in aem:-
Metadata Profiles are used if you have to apply default metadata value to assets within a folder. Means any asset that you subsequently upload to the folder inherits the default metadata that you configured in the Metadata Profile.
Metadata Schema is basically the properties of an asset that you see, it defines what metadata properties displayed for assets that use the particular schema. Means if you want to display any custom property then you definitely need to use custom metadata schema.
Metadata Profiles in AEM:-
to a new location under:
Because of this if you are planning to upgrade from AEM 6.2 to AEM 6.3 you might need to do manual adjustments.
Create Metadata Profile in AEM:-
- Login to AEM author Instance.
- Navigate to Tools-> Assets-> Metadata Profiles
- Click Create and Enter title for your custom Metadata Profile.(For Ex:- Sample Profile)
- Metadata profile Edit form will be displayed.
- You can create a custom property or configure any existing property over here. Let’s add default value to description property.
- Select description property and add Default value to it.
- Map to Property: The value of this property provides the relative path/name to the asset node where it is saved in the repository. The value should always start with “./” because it indicates that the path is under the asset’s node.
- Click Save.
After Saving your metadata profile, it will be save under /conf/global/settings/dam/adminui-extension/metadataprofile/sample-profile.
That’s it you have configured metadata profile. Let’s Apply it to a Folder.
Applying Metadata Profiles to a Folder:-
When you assign a metadata profile to a folder, any sub-folders automatically inherit the profile from its parent folder. This means that you can assign only one metadata profile to a folder. As such, consider carefully the folder structure of where you upload, store, use, and archive assets.
If you assigned a different metadata profile to a folder, the new profile overrides the previous profile. The previously existing folder assets remain unchanged. The new profile is applied on the assets that are added to the folder later.
There are two ways to assign Metadata Profile to a Folder:-
- Navigate to Folder –> Properties –> Metadata Profiles
- Navigate to Tools –> Assets –> Metadata Profiles –> Select the metadata profile that you want to apply to a folder or multiple folders.
Note: If you update metadata profile, the existing assets can’t get updated with new metadata profile until we run “Dam Update Asset” workflow on them.
For More Details about configuring Metadata Profile click here
Metadata Schema in AEM:-
As stated earlier metadata schema is used to defines the layout of the properties page and the metadata properties displayed for assets that use the particular schema. You can use the Metadata Schema Forms editor to modify existing schema or add custom metadata schema.
Create a custom metadata schema form:-
To create a custom metadata schema form, it is advised to copy an existing schema. It will save time for adding existing properties.
- Navigate to Tools –> Assets –> Metadata Schema
- Select any existing metadata schema form, that you want to extend. You can create a blank metadata form also, if you don’t want to reuse exiting forms.
- Click Copy. Enter name for new metadata schema.
- Your new custom metadata schema form is created. You can edit it to add more custom properties.
- Lets add one text field to it.
- Form Right side Panel Drag and drop Single Line Text component on Form.
- Select the newly dropped component.
- Edit the component and add a Title, placeholder text as shown.
- Edit Map to Property from ./jcr:content/metadata/default to your property name that you want to map against it.
Note:- Map to Property specifies the relative path/name to the asset node where it is saved in the CRX repository. It starts with “./” because indicating that the path is under the asset’s node.
- Click Save.
- Apply this metadata schema to a folder.
- Select custom metadata schema from Tools –> Assets –> Metadata Schema.
- Select Apply to Folder and select Folder on which you want to apply.
That’s it you are done you have successfully applied custom metadata schema to your asset folder. You can check it by select properties of any asset under aemcq5tutorials folder.
For more information on metadata schema refer Adobe Docs here.
You can also create metadata schema based on MIME type of asset. For more information read Metadata schema form for custom MIME type