Display Pattern: File Metadata in Layer Fields
Summary
You may want to show the file extension or original filename (standard file metadata) in calculated text fields in a layer. You can make those available to the search and have some basic information shown.
{{outerData.data.imageMetadata.fileExtension | replace: ".", " " | upcase}}
{{outerData.data.documentMetadata.documentTitle}}
{{outerData.data.imageMetadata.fileName}}
Setup in Picturepark
Layer: Corporate Layer
Fields
Text Field; calculated value switched on
You add a text field to a schema, then switch on “calculated value” and add Liquid Syntax code. When the field does not display it cannot be resolved, either because the code is wrong or the values are not available.
Find Non-Layer Fields
The calculated field can not access all values, there is some limitation like linked list items. However, file metadata is available, but you have to choose the correct file type to access it:
Schemas > Files > Image as imageMetadata
Schemas > Files > Video as videoMetadata
Schemas > Files > Document as documentMetadata
Access Non-Layer Fields
The values from imageMetadata, videoMetadata etc. (e.g. "JPEG" as value in fileExtension) are not part of the layer where the text field with the calculated value is added. So to get those values you have to use: outerData (~data outside of this Layer).
Display Pattern
// Layer Fields - Translated Text
{{data.basicInformation.title.en | replace: ".", " " | upcase }}
{{data.basicInformation.title | translate | replace: ".", " " | upcase }}
// Non-Layer Fields
{{outerData.data.imageMetadata.fileExtension | replace: ".", " " | upcase}}
{{outerData.data.imageMetadata.fileName}}
{{outerData.data.documentMetadata.documentTitle}}