Generatr

Liquid syntax

Inject data, branch on conditions, loop over collections, reuse partials and format values with Liquid.

Templates are powered by Liquid. There are two kinds of tags:

  • Output{{ ... }} prints a value. Highlighted yellow in the editor.
  • Logic{% ... %} controls flow (loops, conditions). Highlighted blue.
  • Page variables{{ page_number }} / {{ total_pages }} are green.

The editor's autocomplete triggers inside both {{ }} and {% %} and walks your sample-data JSON one level at a time (type customer → accept → .customer.name, customer.address…).

Variables

Print any value from your JSON data with dot notation:

{{ customer.name }}
{{ invoice.lines[0].label }}
{{ company.address.city }}

If a value is missing, Liquid prints nothing rather than erroring.

Conditions

{% if invoice.paid %}
  Paid in full — thank you!
{% else %}
  Amount due: {{ invoice.total }} €
{% endif %}

You can use and, or, comparisons (==, !=, >, <) and unless:

{% if invoice.total > 1000 and customer.vip %}
  A dedicated account manager will contact you.
{% endif %}

Loops

Iterate over arrays with {% for %}. Inside the loop, the item variable exposes each element:

{% for line in invoice.lines %}
  {{ line.label }} — {{ line.amount }} €
{% endfor %}

Loops work well inside table rows to build dynamic tables. The autocomplete understands the loop scope and offers line.* suggestions inside the block.

Empty &lt;tr&gt; rows left over from loops are cleaned up automatically during rendering, so your tables stay tidy.

Partials with include

Reuse a template inside another with {% include %}, referencing the other template's slug:

{% include 'company-letterhead' %}

Always use include, not render

Use {% include %} rather than {% render %}. include shares the parent's data scope, so the partial can read the same variables; render isolates the scope and your data won't be visible inside it.

Filters

Filters transform a value with a pipe |:

{{ customer.name | upcase }}
{{ invoice.date | date: '%d/%m/%Y' }}
{{ invoice.total | round: 2 }}
{{ description | truncate: 80 }}
{{ items | size }} items

Common filters: upcase, downcase, capitalize, round, truncate, size, default, date, join, first, last.

Page numbers

Page {{ page_number }} of {{ total_pages }}

These reserved variables are injected as placeholders and replaced with real numbers after pagination. Don't define keys with these names in your data.