When working with Neon Notations that have a document_text
attribute, we use [Liquid Templating][1] to dynamically
generate content.
When working with Neon Notations that have a document_text
attribute, we use Liquid
Templating to make documents more dynamic and personalized.
Think of Liquid as a smart fill-in-the-blanks system—instead of manually typing names, dates, and other details, we can use placeholders that get replaced with real data!
For example, instead of writing:
Dear [Client Name],
You can write:
Dear {{ client.name }},
And when processed, it might render as:
Dear John Doe,
Here, client
refers to a person record from the Sagebrush.Directory.Person
schema. The answer to this question
would come from a person
-type question in the flow or alignment, linking to a record in the people
table.
Each question in a flow or alignment collects a specific type of answer, making it available as a variable in your Liquid template.
For example:
"John Doe"
. Sagebrush.Orgs.Org
), referencing the
orgs
table. Using these answers, we can dynamically generate contract text:
This contract is between {{ company.name }} and {{ partner_company.name }}.
Here, company
and partner_company
both reference organization records, meaning they must come from a question
that expects an org
-type answer.
Liquid variables are created using the answers and changelog fields from the AssignedQuestionnaire
record. We
always use the latest answer for a given question code.
For example, let’s say we have these answers stored:
{
"2024-01-01T00:00:00Z": {
"code": "org",
"labels": ["company"],
"response": {"id": "org_123", "name": "Acme Corp"}
},
"2024-01-02T00:00:00Z": {
"code": "org",
"labels": ["company"],
"response": {"id": "org_456", "name": "Beta Industries"}
}
}
Since the second answer is more recent, the latest value for the company
label is:
{
"company": {
"id": "org_456",
"name": "Beta Industries"
}
}
This map is used in our Liquid template, we can now reference:
This contract is between {{ company.name }}.
Which would render as:
This contract is between Beta Industries.
💡 Key takeaway: The org
question expects an organization record as its answer, which is then used in the
template.
Liquid also allows filters, which modify data before it’s inserted. Neon Notations includes custom filters for legal and financial formatting.
currency
FilterFormats numbers as currency:
{{ 10.00 | currency }}
Renders as:
$10.00
By using Liquid Templating, we can: ✅ Automate legal document creation ✅ Personalize content dynamically ✅ Format values correctly—without extra work
For more details, check out the Liquid documentation and explore the custom filters available in Neon Notations! 🚀