Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.elasticfunnels.io/llms.txt

Use this file to discover all available pages before exploring further.

Backend templates insert values with {{ 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 writeMeaning
{{ 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
Paths can use dot notation and array indexing. If a value is missing, it usually renders as empty unless you use the 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.price | currency:product.currency_code }}
{{ product.price | currency:'USD' }}
In the first example, 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.
{{ article.date_short | default:article.published_at | default:article.created_at }}
Chain multiple fallbacks — the first non-empty value wins.
{{ article.author_name | default:'Author' }}
{{ article.reading_time | default:'5' }} min read

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.
{{ score | default_if_none:'0' }}

String filters

upper / lower / capitalize / title

{{ customer.first_name | upper }}       <!-- JOHN -->
{{ customer.first_name | lower }}       <!-- john -->
{{ customer.first_name | capitalize }}  <!-- John -->
{{ product.name | title }}              <!-- My Product Name -->

trim

Strip leading and trailing whitespace.
{{ var.label | trim }}

first / last

Return the first or last character of a string (or first/last element of an array).
{{ customer.first_name | default:'A' | upper | first }}  <!-- initial letter -->
{{ items | last }}

slice — substring

Use slice:start:end (e.g. slice:0:1 for the first character, slice:0:3 for the first 3).
{{ (article.author_name | default:'A') | slice:0:1 }}
Parentheses ensure the whole expression is evaluated first, then 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.
{{ product.sku | replace:'-':' ' }}
{{ phone | replace:'(':'') | replace:')':'' | replace:' ':'' }}

truncate — limit character length

Truncate to N characters, appending ... if the value was cut.
{{ article.excerpt | truncate:160 }}

truncatewords — limit word count

Truncate to N words, appending ... if cut.
{{ article.body | truncatewords:30 }}

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.
{{ customer.notes | nl2br | raw }}

strip_tags — remove HTML tags

Strip all HTML tags from a string. Useful for getting plain text from rich content.
{{ article.body | strip_tags | truncate:200 }}

url_encode — percent-encode for URLs

Encode a value for safe use in a URL query string.
<a href="/search?q={{ query | url_encode }}">Search</a>

length / size

Return the number of characters in a string, or the number of elements in an array. size is an alias.
{{ customer.bio | length }}
{{ order.items | size }}

Number filters

round

Round to the nearest integer, or to N decimal places.
{{ price | round }}       <!-- 42 -->
{{ price | round:2 }}     <!-- 41.99 -->

floor / ceil

Round down or up to the nearest integer.
{{ price | floor }}
{{ price | ceil }}

abs

Absolute value.
{{ order.balance | abs }}

number_format

Format a number with thousands separator and fixed decimal places (default 2).
{{ revenue | number_format }}     <!-- 1,234.56 -->
{{ count | number_format:0 }}     <!-- 1,235 -->

currency

Format a number as currency. Optional arg is the ISO 4217 currency code (default USD).
{{ price | currency }}          <!-- $1,234.56 -->
{{ price | currency:'EUR' }}    <!-- €1,234.56 -->
{{ price | currency:order.currency_code }}

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).
{{ order.active | yesno:'Active':'Inactive' }}
{{ member.verified | yesno:'✓':'✗' }}
{{ score | yesno:'Pass':'Fail':'No score yet' }}

Array filters

join

Join an array into a string with a separator.
{{ tags | join:', ' }}
{{ order.skus | join:' | ' }}

sort

Sort an array alphabetically (strings) or numerically.
{{ categories | sort | join:', ' }}

reverse

Reverse a string or array.
{{ items | reverse }}
{{ 'hello' | reverse }}  <!-- olleh -->

unique

Remove duplicate values from an array.
{{ tags | unique | join:', ' }}

Date filters

date — format a date

Format a Date object, timestamp (ms), or the string 'now' using format tokens.
TokenMeaningExample
yyyy4-digit year2024
yy2-digit year24
MMMMFull month nameJanuary
MMMShort month nameJan
MM2-digit month01
MMonth (no padding)1
dd2-digit day05
dDay (no padding)5
HH / HHour 24h (padded / not)09 / 9
hh / hHour 12h (padded / not)09 / 9
mm / mMinute (padded / not)04 / 4
ss / sSecond (padded / not)07 / 7
{{ order.created_at | date:'MMM d, yyyy' }}    <!-- Jan 5, 2024 -->
{{ 'now' | date:'yyyy' }}                       <!-- current year -->
{{ order.created_at | date:'dd/MM/yyyy' }}

date_add — add days to a date

Add N days to a date value. Returns a Date object — chain with | date to format.
{{ order.created_at | date_add:30 | date:'MMM d, yyyy' }}
{{ subscription.start_date | date_add:365 | date:'MMM d, yyyy' }}
Use a negative number to subtract days.
{{ 'now' | date_add:-7 | date:'MMM d, yyyy' }}   <!-- 7 days ago -->

timeago — relative time

Render a date as a human-readable relative string.
{{ order.created_at | timeago }}       <!-- 3 days ago -->
{{ event.starts_at | timeago }}        <!-- in 2 hours -->

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).
{{ article.body | raw }}
{{ (post.excerpt | default:post.summary | default:'') | raw }}
{{ customer.notes | nl2br | raw }}

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.
<div data-config="{{ settings | json | raw }}"></div>
<script>var config = {{ settings | json | raw }};</script>

Patterns from real templates

Date with fallbacks:
<span>{{ article.date_short | default:article.published_at | default:article.created_at }}</span>
Avatar initial when no image:
{{ (article.author_name | default:'A') | slice:0:1 }}
Excerpt or summary, then output as HTML:
{{ (featured[0].excerpt | default:featured[0].summary | default:'') | raw }}
First initial from full name:
{{ customer.first_name | default:'F' | upper | first }}
Price formatted as currency:
{{ product.price | currency:'USD' }}
Trial end date:
Your trial ends on {{ subscription.start_date | date_add:14 | date:'MMM d, yyyy' }}.
Multi-line user notes:
{{ customer.notes | nl2br | raw }}
Embed data as JSON:
<div data-product="{{ product | json | raw }}"></div>
Optional category:
@if(post.category)
  <span>{{ post.category.name }}</span>
@endif

String concatenation: +

Use the + operator to join strings, variables, and filtered expressions together.
{{ "(" + var.guarantee_title + ")" }}
You can combine it with filters by wrapping the filtered part in parentheses:
{{ "(" + (var.guarantee_title | default:"90-Day Money Back Guarantee") + ")" }}
This works everywhere expressions are accepted — in {{ }}, in @set, and in @component arguments:
@component("purchase-box", {
  title_suffix: "(" + (var.guarantee_title | default:"90-Day Guarantee") + ")"
})
@set(label = "Order #" + order.id)
{{ label }}
Strings are literal — there is no variable interpolation inside quotes. Writing "price is: {{ price }}" outputs the text price is: {{ price }} verbatim, it does not resolve the variable. To mix text and variables, use concatenation:
{{-- ✗ wrong — {{ }} inside a string is literal text, not a variable --}}
{{ "price is: {{ price }}" }}

{{-- ✓ correct — concatenate the string and the variable --}}
{{ "price is: " + price }}

Filter reference

FilterCategoryArgExample
defaultFallback'fallback'{{ name | default:'Anonymous' }}
default_if_noneFallback'fallback'{{ score | default_if_none:'0' }}
upperString{{ name | upper }}
lowerString{{ name | lower }}
capitalizeString{{ name | capitalize }}
titleString{{ name | title }}
trimString{{ label | trim }}
firstString/Array{{ name | first }}
lastString/Array{{ name | last }}
sliceString/Arraystart:end{{ name | slice:0:1 }}
replaceString'old':'new'{{ sku | replace:'-':' ' }}
truncateStringN{{ text | truncate:100 }}
truncatewordsStringN{{ text | truncatewords:20 }}
nl2brString{{ notes | nl2br | raw }}
strip_tagsString{{ body | strip_tags }}
url_encodeString{{ query | url_encode }}
length / sizeString/Array{{ items | length }}
roundNumberdecimals{{ price | round:2 }}
floorNumber{{ price | floor }}
ceilNumber{{ price | ceil }}
absNumber{{ balance | abs }}
number_formatNumberdecimals{{ revenue | number_format:2 }}
currencyNumber'USD'{{ price | currency:'USD' }}
yesnoBoolean'yes':'no'{{ active | yesno:'Yes':'No' }}
joinArray','{{ tags | join:', ' }}
sortArray{{ items | sort }}
reverseString/Array{{ items | reverse }}
uniqueArray{{ tags | unique }}
dateDate'format'{{ date | date:'MMM d, yyyy' }}
date_addDateN days{{ date | date_add:30 }}
timeagoDate{{ date | timeago }}
rawOutput{{ html | raw }}
jsonOutput{{ obj | json | raw }}

Summary

  • Use {{ path }} to output a value; use | filter or | filter:arg to transform it.
  • Chained defaulta | default:b | default:c gives 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.
These functions generate URLs for purchase and subscription actions. Use them in link href attributes.
FunctionOutputDescription
{{ upsell_upgrade('old_sku', 'new_sku') }}JS action URLUpgrade subscription from one product to another
{{ upsell_cancel() }}JS action URLCancel the current subscription
These can also be used as filters: {{ '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.