Skip to main content

Filters

Filters transform a value at the point of use, inside {{ … }}. They are written pipe-style — {{ value | filter }} — and can be chained. Most are the standard filters that ship with the templating engine; a few are custom filters built for this email system. This page documents the custom ones and points at the rest.

:::caution Strict mode The renderer runs in strict mode: referencing a filter that does not exist — or a field that is not on the model — is a hard error, surfaced when the template is saved, not at send time. Stick to the filters listed here. :::

Custom filters

t — translation lookup

Resolves a translation key to localized copy.

{{ 'order_scheduled.greeting' | t }} {# uses the active render locale #}
{{ 'legal.disclaimer' | t: 'en' }} {# force a specific locale #}
  • With no argument, the active locale of the render is used.
  • Passing a locale argument overrides it for that one usage — handy for a block that must stay in a fixed language (e.g. a legal line).
  • If the (key, locale) pair has no translation, the key itself is returned so partially translated content stays readable. See Localization.

date — recipient-localized instant

Renders a single date/time value as the recipient sees it.

{{ Order.ScheduledAt | date }} → 15/01/2026 9:15 PM • UTC+03:00
{{ Order.ScheduledAt | date: false }} → 15/01/2026 9:15 PM
  • The timezone and the 12-hour / 24-hour clock come from the recipient automatically — the template never names them (see Recipient-aware localization below).
  • The locale drives the date layout and the AM/PM wording.
  • Pass false to drop the trailing • UTC±hh:mm label.
  • The input must be a date/time field. This filter does not take a format string — formatting is decided for you so every email is consistent.

date_range — recipient-localized start–end range

Renders two instants as one localized range string. The value piped in is the start; the single argument is the end.

{{ trip.From | date_range: trip.To }}
→ 5/6/2026 9:15pm – 11:30pm UTC+03:00 {# same day #}
→ 5/6/2026 10:00pm – 6/6/2026 1:30am UTC+00:00 {# spanning days #}
  • Like date, the timezone and clock preference come from the recipient — no timezone is named in the template.
  • Both the piped value and the argument must be date/time fields; otherwise the filter renders nothing.

Recipient-aware localization

date and date_range localize their output per recipient. When a real email is sent, the system knows each recipient's timezone, language, and clock preference and renders the dates accordingly — the same template produces 9:15pm UTC+03:00 for one recipient and 6:15pm UTC for another, with no per-recipient work in the template.

:::note Previews show defaults A preview or a test send has no specific recipient, so these filters fall back to UTC and the 12-hour clock. The times you see while authoring may differ from what a real recipient receives — that is expected. :::

Standard filters

The full standard filter library is available too. Commonly used ones:

  • Text: append, prepend, capitalize, upcase, downcase, strip, replace, truncate, split, escape, url_encode
  • Defaults: default — fall back to a value when a field is empty, so a blank field never leaves a hole in the email ({{ Order.Note | default: '—' }}).
  • Lists: join, first, last, size, map, where, sort, uniq
  • Numbers: plus, minus, times, divided_by, round, ceil, floor

For dates, prefer the custom date / date_range filters above so output stays recipient-correct and consistent across every template.