Template filters
This page provides a reference for all the available filters that can be used when defining templates.
capitalize
The capitalize
filter allows to modify a string so that the first letter is converted to uppercase and all the subsequent letters are converted to lowercase.
For example:
{{ value|capitalize }}
If value
is "marten", the output will be "Marten".
default
The default
filter allows to fallback to a specific value if the left side of the filter expression is empty or not truthy. A filter argument is mandatory. It should be noted that empty strings are considered truthy and will be returned by this filter.
For example:
{{ value|default:"foobar" }}
If value
is nil
(or 0
or false
), the output will be "foobar".