Backend templates insert values withDocumentation Index
Fetch the complete documentation index at: https://docs.elasticfunnels.io/llms.txt
Use this file to discover all available pages before exploring further.
{{ path }} and can transform them with filters using the pipe character: {{ path | filter }} or {{ path | filter:arg }}.
For filter:arg, the argument can be either:
- a context path/expression (for example
product.currency_code) - or a literal (recommended as quoted text, for example
'USD'or'stripe')
Variables: {{ path }}
Values are resolved from the current context (e.g. page data, article, posts, featured).
| You write | Meaning |
|---|---|
{{ article.title }} | Property of the current article |
{{ post.details_url }} | URL for a post (e.g. in a loop) |
{{ featured[0].title }} | First featured item’s title |
{{ blog_base_url | default:'/blog' }} | URL with fallback |
default filter.
Filters
Filters are applied left to right. You can chain several:{{ value | filter1 | filter2:arg }}.
Filter arguments (:arg)
Use :arg when a filter needs one parameter.
product.currency_code is resolved from context (for example, USD).In the second example,
'USD' is a fixed literal.
If you want text to always be treated as literal, quote it.
Fallback filters
default — fallback when value is empty
If the value is empty (null, undefined, or empty string), the filter returns the argument instead.
default_if_none — fallback only for null/undefined
Like default, but only triggers when the value is null or undefined. An empty string passes through unchanged.
String filters
upper / lower / capitalize / title
trim
Strip leading and trailing whitespace.
first / last
Return the first or last character of a string (or first/last element of an array).
slice — substring
Use slice:start:end (e.g. slice:0:1 for the first character, slice:0:3 for the first 3).
slice is applied to the result.
replace — find and replace
Replace all occurrences of a substring. Arg format: 'old':'new'. Plain string replacement — no regex.
truncate — limit character length
Truncate to N characters, appending ... if the value was cut.
truncatewords — limit word count
Truncate to N words, appending ... if cut.
nl2br — newlines to <br>
Convert newline characters to <br> tags. The value is HTML-escaped first, so user content is safe. Chain with | raw to render the output as HTML.
strip_tags — remove HTML tags
Strip all HTML tags from a string. Useful for getting plain text from rich content.
url_encode — percent-encode for URLs
Encode a value for safe use in a URL query string.
length / size
Return the number of characters in a string, or the number of elements in an array. size is an alias.
Number filters
round
Round to the nearest integer, or to N decimal places.
floor / ceil
Round down or up to the nearest integer.
abs
Absolute value.
number_format
Format a number with thousands separator and fixed decimal places (default 2).
currency
Format a number as currency. Optional arg is the ISO 4217 currency code (default USD).
Boolean / conditional filters
yesno
Return a string based on whether the value is truthy or falsy. Arg format: 'yes':'no' or 'yes':'no':'maybe' (the third value is used for null/undefined).
Array filters
join
Join an array into a string with a separator.
sort
Sort an array alphabetically (strings) or numerically.
reverse
Reverse a string or array.
unique
Remove duplicate values from an array.
Date filters
date — format a date
Format a Date object, timestamp (ms), or the string 'now' using format tokens.
| Token | Meaning | Example |
|---|---|---|
yyyy | 4-digit year | 2024 |
yy | 2-digit year | 24 |
MMMM | Full month name | January |
MMM | Short month name | Jan |
MM | 2-digit month | 01 |
M | Month (no padding) | 1 |
dd | 2-digit day | 05 |
d | Day (no padding) | 5 |
HH / H | Hour 24h (padded / not) | 09 / 9 |
hh / h | Hour 12h (padded / not) | 09 / 9 |
mm / m | Minute (padded / not) | 04 / 4 |
ss / s | Second (padded / not) | 07 / 7 |
date_add — add days to a date
Add N days to a date value. Returns a Date object — chain with | date to format.
timeago — relative time
Render a date as a human-readable relative string.
Output / serialization filters
raw — output HTML unescaped
By default, output is HTML-escaped for safety. Use raw only for trusted HTML (e.g. stored rich content like article body or excerpt).
json — serialize to JSON
Serialize any value to a JSON string. Safe: uses JSON.stringify, no code is executed. Chain with | raw to embed the output in HTML attributes or <script> tags without double-escaping.
Patterns from real templates
Date with fallbacks:String concatenation: +
Use the + operator to join strings, variables, and filtered expressions together.
{{ }}, in @set, and in @component arguments:
Filter reference
| Filter | Category | Arg | Example |
|---|---|---|---|
default | Fallback | 'fallback' | {{ name | default:'Anonymous' }} |
default_if_none | Fallback | 'fallback' | {{ score | default_if_none:'0' }} |
upper | String | — | {{ name | upper }} |
lower | String | — | {{ name | lower }} |
capitalize | String | — | {{ name | capitalize }} |
title | String | — | {{ name | title }} |
trim | String | — | {{ label | trim }} |
first | String/Array | — | {{ name | first }} |
last | String/Array | — | {{ name | last }} |
slice | String/Array | start:end | {{ name | slice:0:1 }} |
replace | String | 'old':'new' | {{ sku | replace:'-':' ' }} |
truncate | String | N | {{ text | truncate:100 }} |
truncatewords | String | N | {{ text | truncatewords:20 }} |
nl2br | String | — | {{ notes | nl2br | raw }} |
strip_tags | String | — | {{ body | strip_tags }} |
url_encode | String | — | {{ query | url_encode }} |
length / size | String/Array | — | {{ items | length }} |
round | Number | decimals | {{ price | round:2 }} |
floor | Number | — | {{ price | floor }} |
ceil | Number | — | {{ price | ceil }} |
abs | Number | — | {{ balance | abs }} |
number_format | Number | decimals | {{ revenue | number_format:2 }} |
currency | Number | 'USD' | {{ price | currency:'USD' }} |
yesno | Boolean | 'yes':'no' | {{ active | yesno:'Yes':'No' }} |
join | Array | ',' | {{ tags | join:', ' }} |
sort | Array | — | {{ items | sort }} |
reverse | String/Array | — | {{ items | reverse }} |
unique | Array | — | {{ tags | unique }} |
date | Date | 'format' | {{ date | date:'MMM d, yyyy' }} |
date_add | Date | N days | {{ date | date_add:30 }} |
timeago | Date | — | {{ date | timeago }} |
raw | Output | — | {{ html | raw }} |
json | Output | — | {{ obj | json | raw }} |
Summary
- Use
{{ path }}to output a value; use| filteror| filter:argto transform it. - Chained
default—a | default:b | default:cgives the first non-empty value. slice:0:1— First character; combine with(expression | default:'X')for safe initials.raw— Use only for trusted HTML (e.g. article body, nl2br output, json).- Parentheses —
{{ (expression) | filter }}so the filter applies to the whole expression. - Concatenation —
"text" + variable + "more text"joins values. No interpolation inside strings; use+instead.
Purchase Link Functions
These functions generate URLs for purchase and subscription actions. Use them in linkhref attributes.
| Function | Output | Description |
|---|---|---|
{{ upsell_upgrade('old_sku', 'new_sku') }} | JS action URL | Upgrade subscription from one product to another |
{{ upsell_cancel() }} | JS action URL | Cancel the current subscription |
{{ 'old_sku' | upsell_upgrade('new_sku') }}.
See Subscription Upsells for usage details and examples.
For conditionals and loops, see Directives. For client-side templates, see Frontend Template Engine.