Table of contents
what are variables in TemplateTo
What are variables
Variables are bits of data you can manipulate based on your templates requirements. We support the liquid templating language within our template builder and you can use this within the variable builder to create custom template variables.
To start, navigate to the data tab:
In the data tab you will see two sections. Template Data and Liquid Data.
Template data is the data you will pass into the template with the generation request. You can add some json data here to represent the data you will pass, this allows you to preview your template with example data in it.
If you don't know JSON, don't worry, you can use the button to add your data as a name value pair. The way this works is, the name you give the item will be what you use in the template and it will be swapped for the value when the template is generated.
The liquid data allows you to add variables that build upon the data that gets passed into the system.
This is based on the liquid templating filters, you can see more details here: https://shopify.github.io/liquid/basics/introduction/
We have extended this with our own filter. parse_date, this filter has an optional parameter that tells us is the input being parsed is a US format date. If it is modify the filter with : true. We created this filter to give better date parsing functionality to the system as the date parsing within liquid isn't very good.
liquid data examples:
|Current date time||"now" | date: "%Y-%m-%d %H:%M"|
|Reformat a variable called contract_date from 02/03/2023 to 2 March 2023||contract_date | parse_date | date: “%e %B %Y”|
Create your date format string here: https://strftime.net/