PDFMonkey Liquid tags

load_snippets / include

As documented in the Snippets documentation, you can import and include Snippets in a Template. They're just like partials (see below) but shared.

Snippet: greating
<p>Hello {{name}}!</p>
Input
{%- load_snippets 'greating' -%}
{% include 'greating', name: "Jane Doe" %}
Output
<p>Hello Jane Doe!</p>

partial / include

Partials are like Snippets but located directly within a Template and you don't need to load them before including them:

Input
{%- partial 'line-item' -%}
  <tr>
    <td>{{product.name}}</td>
    <td>{{product.unitPrice}}</td>
    <td>{{product.quantity}}</td>
    <td>{{product.totalPrice}}</td>
  </tr>
{%- endpartial -%}

{% for lineItem in lineItems %}
  {% include 'line-item', product: lineItem %}
{% endfor %}

Last updated