Metadata variable - Fluid Topics - Latest

Fluid Topics Configuration and Administration Guide

Category
Reference Guides
Audience
public
Version
Latest

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:

A small table with two rows. The first row has the label 'Audience' with the value 'public, restricted'. The second row has the label 'Version' with the value '1'.

When the audience metadata is undefined, the result is as follows:

A small table with two rows. The first row has the label 'Audience' with the value 'Not defined'. The second row has the label 'Version' with the value 'v1.0'.

When a single template is used multiple times, it is necessary to use the #if Velocity directive to apply the metadata variable correctly.