Skip to content
Content SnareHelp centre

Liquid variables and filters

Quick answer

Your email and SMS templates use Liquid. A variable in double curly braces fills in a detail at send time, like the client's name or the request link, and a filter after a pipe changes how it comes out. If you misspell a variable, the email still sends with a blank in its place.

Your email and SMS templates run on Liquid, a small templating language that fills in details at send time and can hide or show text based on the request. A variable in double curly braces, like {{client.contact_first_name}}, is swapped for the real value when the message goes out. A filter after a pipe, like {{company.image | img_tag}}, changes how that value comes out. And a condition wrapped in {% if %} shows its text only when the test is true.

You write these tags directly in the body of an email or SMS template. To find where templates live and how to open one, see email and SMS templates.

Variables you can use

Every variable belongs to one of six objects: request, company, client, folder, owner and comment. Name the object, then the detail, like {{request.name}}. There is no field, page or section object, so a tag like {{field.name}} always comes out blank.

client is the person you are collecting from. owner is the team member who owns the request. Both give you the same set of contact details.

Variable What it gives you
request.name The name of the request
request.link The web address the client uses to open the request
request.due_date The request's due date
request.days_remaining Days left until the due date
request.completion_percentage How much is done, as text with the percent sign, like 25%
request.share_passcode The PIN protecting a shared-link request, or a line explaining how the client gets one
request.password_update_link The client's password reset link
request.incomplete_fields_list A list of the questions the client can see and hasn't answered
request.export_link The address a client uses to download the request
request.requires_activation True when the request needs a login and the client hasn't accepted their invitation
request.not_shared_by_link True when the request is not open by shared link
request.will_expire True only in the email telling the client access has closed. That email goes out when the request has Close client access after the due date on and a client email scheduled for the due date
company.name Your company name
company.contact Your company contact name
company.image The URL of your company image
company.logo The URL of your logo, on plans with white labeling turned on
company.client_portal_link A link to your client portal, when the portal is on
client.contact / owner.contact Full name
client.contact_first_name / owner.contact_first_name First name
client.contact_last_name / owner.contact_last_name Last name
client.contact_salutation / owner.contact_salutation Salutation
client.email / owner.email Email address
client.image / owner.image The URL of their profile image
client.company_name The client's own company name
folder.name The name of the request's folder

The comment variables, {{comment.text}}, {{comment.author_name}}, {{comment.author_image}} and {{comment.link}}, only fill in on the two comment notification emails: New comment and New comment (internal). Put them in any other template and they come out empty, because there is no comment to pull from.

Filters

A filter goes after a variable and a pipe, and changes what the variable produces. Content Snare supports the standard Liquid filters, such as upcase and default, and adds four of its own.

Filter Example What it produces
link_to {{request.link | link_to: request.link}} A clickable link
button_to {{'Open your request' | button_to: request.link}} A styled button
img_tag {{company.image | img_tag}} An image, from an image URL
date {{'now' | date}} A formatted date

link_to and button_to take the destination address as the value after the colon, which is why request.link appears twice in the first example: once as the text, once as the target.

Dates

{{'now' | date}} with no format renders the date in the client's own language and local format. To set the format yourself, add a format string, for example {{'now' | date: '%d %B %Y'}}. Test any format string you rely on before you send, since the exact output depends on the pattern you write.

Every email renders in the client's locale, including your internal ones, so a date with no format string reflects the client's language rather than yours. If a date appears in a language you did not expect, that is why. See language and region for how a client's locale is set.

Buttons need styling turned on

button_to only draws a styled button when the template has styling switched on. Turn styling off for that template and every button becomes a plain text link instead. SMS templates are always unstyled, so a button there is always a link.

Showing text only when a condition is true

Wrap text in {% if %} and {% endif %} to include it only when the test passes. Shopify's Liquid reference covers the full set of control flow tags and the operators you can test with. This example shows a line only when the request name contains the word "Website":

{% if request.name contains "Website" %}
  Shown only when the request name contains "Website".
{% endif %}

You can also test a true or false value. This shows a line only when the client still has to accept an invitation and log in:

{%- if request.requires_activation -%}
Accept your invitation to get started.
{%- endif -%}

request.will_expire is true only in the email that tells the client access has closed. In the default schedule that email is Due Today. If you've edited your Due Today email, it keeps your wording and won't mention expiry until you add a condition like this one:

{% if request.will_expire %}
Access to this request has closed. Contact us if you need more time.
{% else %}
Your request is due today.
{% endif %}

The template preview always shows the else text.

Pick a variable that comes out empty when the thing is absent. request.share_passcode is not one. When there is no passcode it returns a line explaining how the client gets one, which counts as a value, so a test on it is always true. Liquid's rules for what counts as true explain why.

The hyphens inside those tags, {%- and -%}, trim the surrounding whitespace so the condition does not leave an empty paragraph behind.

{{request.completion_percentage}} comes out as text with the percent sign attached, like 25%, not a plain number, so comparing it with < or > won't work on its own. Strip the sign and turn it into a number first, in a separate tag, because a condition can't hold a filter:

{%- assign percent = request.completion_percentage | remove: '%' | plus: 0 -%}
{%- if percent < 20 -%}
You've made a start. Anything you can add this week helps.
{%- endif -%}

When a tag comes out wrong

A Liquid syntax error, such as an {% if %} with no matching {% endif %}, stops the template saving and shows you the error, so you fix it before it ever sends.

A misspelled or non-existent variable is different. The template saves without complaint, and at send time the bad tag renders as a blank while the email still goes out. When an email arrives with a gap where a value should be, check the spelling of the tag and confirm it is one of the variables listed above.