Home Filters
Filters
Filters are simple methods that modify the output of numbers, strings, variables and objects. They are placed within an output tag {{
}}
and are separated with a pipe character |
.
Input
<!-- product.name = "Awesome Shoes" -->
{{ product.name | upcase }}
Output
AWESOME SHOES
In the example above, product is the object, name is its attribute, and upcase is the filter being applied.
Some filters require a parameter to be passed.
Input
{{ product.name | remove: "Awesome" }}
Output
Shoes
Multiple filters can be used on one output. They are applied from left to right.
Input
<!-- product.name = "Awesome Shoes" -->
{{ product.name | upcase | remove: "AWESOME" }}
Output
SHOES