Asset Metadata AEM : Comprehensive Guide
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:-
AEM 6.2 onward, the location where Metadata Profiles are stored in the repository has changed. Upon upgrading, they are moved from their location in AEM 6.1 at :
- /apps/dam/ingestion/profiles/metadata
to a new location under:
- /conf/global/settings/dam/adminui-extension/metadataprofile
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
AEMAsCloud Metadata Schema Quick Fixes:-
Issue 1 :- Not able to add more than 150+ fields in AEM Asset metadata schema in AEMAsCloud environment.
Recently I have faced one issue, where i need to add 200+ metadata fields to a schema with lot of dropdown, but after adding more that 150 fields and clicking on Save button, it is not adding the fields to metadata schema.
Strange part was that the network call that goes for saving the metadata schema, that is showing 200 response and in logs also we are not seeing any error.
After spending good amount of efforts , we figured out that when we click on save button all the fields as going as parameters to the AEM API call and because we have too many drop downs and with each dropdown having multiple values, each value is going as a separate parameter in request due to which we have hit the default limit set by as 10000. By default Max File Count limit & Sling Default Max Parameters is set as 10000 in Apache Sling Request Parameter Handling.
So, in order to fix this issue we updated Max File Count limit value from 10000 to 100000 (You can increase it to 20k also as per your requirements) & Sling Default Max Parameters field value from 10000 to 20000 in org.apache.sling.engine.parameters sling OSGI config, also known as Apache Sling Request Parameter Handling as shown below :-
This configuration also resolves, issue related with character encoding and Max post parameters.
For example:- If you are using AEM sites and passing parameters to AEM servlet and want to change the character default encoding then it can be achieved by updating Default Parameter Encoding property in this configuration.
Leave a Reply