Formatting variable output

Waypoint's template builder takes advantage of the Liquid template language to populate the dynamic parts of a template.

While Liquid has an advanced set of tags and deeper functionality, due to the visual nature of Waypoint's template builder, most use Liquid on Waypoint to output data and to format them with filters.

Output data

To output the value of one of your variables from your template data use Liquid output syntax. Example:

Data:

{ "user": { "firstName": "Jordan" } }

Input:

Hello {{user.firstName}}

Output:

Hello Jordan

Standard filters

One of the key features of Liquid is being able to transform or format the data by using filters. Waypoint allows for all of the standard Liquid filters from Liquid. Below are some of our favorites:

Default

Allows you to specify a fallback in case a value doesn’t exist (without having to use a more complex conditional).

Data:

{ "user": { "fullName": "" } }

Input:

Hi {{user.fullName | default: 'there'}}

Output:

Hi there

Capitalize

Makes the first character of a string capitalized.

Data:

{ "user": { "role": "admin" } }

Input:

{{user.role | capitalize}}

Output

Admin

Truncate

Shortens a string down to the number of characters passed as an argument.

Input:

{{ "Build and send emails, faster than ever." | truncate: 25 }}

Output

Build and send emails...

Custom filters

Waypoint also offers set of custom built-in filters that extend LiquidJS and is available for use within Waypoint templates.

Currency

Format a number with a currency. Defaults to USD.

Input:

{{ 40.5 | currency }}

Output

$40.50

Currency codes and locales can be passed in as options to format a number to localized currency (defaults to 'en-US'):

Input:

{{ 10 | currency: 'EUR', 'fr-FR'}}

Output:

10,00 €

Pluralize

Provides a singular and plural version of a word based on a number.

Input:

1 {{ 1 | pluralize: 'friend', 'friends' }}

Output

1 friend