Back

Displaying Metadata values from a File Content Type

Description

When a new file is uploaded dotCMS extracts its metadata and indexes it for searches or to be displayed.

This sample shows how to take a list of file content types and display their metadata key values.

Code

#foreach($con in $dotcontent.pull("+structureName:FileAsset",2,"modDate desc"))
File: $con.title
MetaData: $con.metaData
##Loop through all metadata field key, values
#foreach($md in $con.metaData.entrySet())
$md.key : $md.value
#end
##Print each value separately:
Content type: $con.metaData.contentType
File Size: $con.metaData.fileSize
#end