Modifiers

Modifiers manipulate the data of your variables on the fly in Antlers templates. They can modify strings, filter arrays and lists, perform comparisons, handle basic math, simplify your markup, and even help you debug.

Overview

Modifiers are available exclusively in Antlers templates. Each modifier is a function that accepts the value of the variable it’s attached to, can do just about anything with that data, and then returns it. Multiple modifiers chained onto a variable will be executed in sequence, each passing its modified value onto the next.

Example

You could take some text, render it as markdown, uppercase it, and ensure there are no widows (lines with only one word on them) like this:

// This...
{{ "Ruth, Ruth, Ruth! Baby Ruth!" | markdown | upper | widont }}

// Becomes this!
<p>RUTH, RUTH, RUTH! BABY&nbsp;RUTH!</p>

Eager for more knowledge? Check out Antler’s modifier syntax and discover how to build your own.

Core Modifiers

Array

Asset

Conditions

Date

Markup

Math

Relationship

String

Utility

Betterify this page on Github!