Skip to content

Custom Liquid Filters

Custom filters extending standard Liquid, available in all templates.

asset_url

Returns the CDN URL for a file uploaded to the agency's asset library via Website > Templates.

liquid
{{ 'style.css' | asset_url }}

May be chained with stylesheet_tag or script_tag:

liquid
{{ 'style.css' | asset_url | stylesheet_tag }}
{{ 'app.js' | asset_url | script_tag }}

TIP

To simply handle cache-busting during development and following asset changes, refer to the cache bust snippet.

Also see syngency_asset_url.

Returns the URL for a specific size of a gallery image. Available sizes are small, medium, large.

liquid
{{ image | gallery_img_url: 'medium' }}

handleize

Converts a string to a URL-friendly handle — lowercase, accents removed, special characters stripped, spaces replaced with hyphens.

liquid
{{ 'New Faces' | handleize }}
output
new-faces

img_tag

Renders an <img> tag from a URL. Accepts an optional alt attribute.

liquid
{{ model.headshot_url | img_tag: 'Headshot' }}

initials

Returns the uppercased initials from a name string — first letter of first and last name.

liquid
{{ model.display_name | initials }}
output
JS

Renders an <a> tag. Accepts url and an optional title attribute.

liquid
{{ model.display_name | link_to: model.url, 'View profile' }}

money_without_currency

Formats a numeric value as a money amount without a currency symbol, using the agency's locale settings.

liquid
{{ booking.amount | money_without_currency }}

number_abbreviate

Abbreviates large numbers with K or M suffixes.

liquid
{{ model.instagram_followers | number_abbreviate }}
{# 1500 => 1 K, 1500000 => 1 M #}

output

Dumps an object as a <pre>-formatted string. Intended for use during template development only — avoid output on public-facing pages as the object may contain sensitive data.

liquid
{{ model | output }}

TIP

When output is required on a public site, consider only outputting with a querystring e.g. ?test=260131. This has less risk if accidentally left in place than wrapping in display: none, which may still be picked up by crawlers.

liquid
{% if querystring.test == 260131 %}
{{ model | output }}
{% endif %}

pluralize

Returns the singular or plural string based on a count.

liquid
{{ model.galleries | size | pluralize: 'gallery', 'galleries' }}

range

Returns an array of integers between two values, inclusive.

liquid
{% assign nums = 1 | range: 5 %}
{# => [1, 2, 3, 4, 5] #}

script_tag

Renders a <script> tag for a JavaScript file.

liquid
{{ 'plugins.js' | asset_url | script_tag }}

size

Returns the number of items in an array. Returns false if the value is not an array. Can be used as a standard Liquid filter or with dot notation.

liquid
{{ gallery.files | size }}
{% if gallery.files.size %} ... {% endif %}

stylesheet_tag

Renders a <link> tag for a CSS file. Accepts an optional media attribute (defaults to all).

liquid
{{ 'style.css' | asset_url | stylesheet_tag }}
{{ 'print.css' | asset_url | stylesheet_tag: 'print' }}

syngency_asset_url

Returns the URL for a centrally hosted Syngency platform asset, shared across all agencies. Used for shared theme stylesheets and scripts.

liquid
{{ 'theme.css' | syngency_asset_url | stylesheet_tag }}

Also see asset_url.

t

Returns a translation string from the active locale file. Locale files are JSON files (e.g. en.json, fr.json) managed under Website > Templates > Locales. Active locale is determined by the URL e.g. agency.com/en/divisions/mainboard, and defaults to en when no locale exists.

liquid
{{ 'nav.home' | t }}

Dot notation maps to nested keys in the locale JSON:

json
{
  "nav": {
    "home": "Home"
  }
}

TIP

Translation keys can also be constructed with Liquid variables, which is helpful when working with dynamic strings like division names.

liquid
{% assign divisionName = division.name %}
{% assign divisionLocaleKey = divisionName | handleize | replace: '-', '_' | prepend: 'models.divisions.' %}
{{ divisionLocaleKey | t }}

Corresponding to locale JSON with translations for each division name:

json
{
  "models": {
    "divisions": {
      "mainboard": "Mainboard",
      "commercial": "Commercial"
    }
  }
}

url_escape

URL-encodes a string for safe use in query parameters.

liquid
{{ model.display_name | url_escape }}

within

Returns a model URL scoped within a division. Used to generate division-specific portfolio links.

liquid
{{ model.url | within: division }}