The $metadata
variable contains a dictionary of metadata. The keys of the dictionary are the metadata keys of the document, and their values.
The metadata
variable is not available for personal books.
For example:
{ft:editorialType=book, FT_Version=Latest, Category=Technical Notes, ft:prettyUrl=Integrate-the-Fluid-Topics-API}
Use case:
The following lines show an example of how to use the $metadata
variable in the pdf-template.vm
file:
<table>
<tr>
<td><strong>Audience</strong></td>
<td>
#if($metadata["audience"])
$metadata["audience"]
#else
Not defined
#end
</td>
</tr>
<tr>
<td><strong>Version</strong></td>
<td><strong>$metadata["version"]</strong></td>
</tr>
</table>
The preceding example provides the following result when the audience
metadata is defined:
When the audience
metadata is undefined, the result is as follows:
When a single template is used multiple times, it is necessary to use the #if
Velocity directive to apply the metadata
variable correctly.