Links

JavaScript and Dynamic Data

The Template editor provides an HTML and a CSS tab but no JavaScript one. You can still use JavaScript though!
To use JS in your Templates, you can open a script tag and start working.
HTML
<script>
// Write some JavaScript in here.
</script>

Accessing the Document payload

To make using JavaScript in your Template more powerful, you can access your Document payload as a JavaScript object.
Start by enabling JavaScript injection for your Template in its Settings tab:
Let's say you defined your payload as follows:
JSON
{
"movie": {
"title": "12 Monkeys",
"year": 1995
}
}
You can now access the payload data this way:
HTML
<script>
let movieTitle = $docPayload.movie.title;
</script>