Template example - Fluid Topics - Latest

Jinja Connector Reference Guide

Category
Reference Guides
Audience
public
Version
Latest

Using the following Jinja template, Fluid Topics can publish the following JSON file:

<html>
    <head>
        <title>{{ data.title }}</title>
        <meta name="document_type" content="{{ data.document_type }}">
        <meta name="ft:locale" content="{{ data.language }}">
    </head>
    <body>
        {{ data.content|safe }}
    </body>
</html>
{
    "title": "This is an example",
    "document_type": "Technical Notes",
    "language": "en-US",
    "content": "<h1>Chapter 1</h1><p>Lorem ipsum dolor</p><h2>Chapter 2</h2>...",
}

In the previous template:

  • <title>{{ data.title }}</title> defines the publication title.
  • <meta name="document_type" content="{{ data.document_type }}" defines a custom metadata key called document_type with a value of Technical Notes.
  • <meta name="ft:locale" content="{{ data.language }}"> defines the ft:locale built-in metadata key that defines the publication locale.
  • <body>{{ data.content|safe }}</body> defines the content as HTML without escaping the HTML tags thanks to the safe filter. The publication content is automatically split into topics using the header tags.