Add text to the end of the input. If the input is not already a string it will be converted to one using the default behavior for its object type.
append: String text
Append text onto the end of a string
Append text
Copy
Capitalize words in a string
capitalize
Capitalize all of the words in a sentance
Capitalize words in a string
CopyRemoves all non-alphanumeric characters other than dashes and underscores from a string and replaces them with the separator (or nothing if the separator is empty) to form a valid CSS classname.
classname: String separator
Convert a string to lowercase
downcase
Encode a string to be output as HTML. All special HTML characters will be converted to their equivalent HTML character entities (eg: < becomes &lt;)
escape
Encode a string to be output as HTML, without changing existing escaped entities.
escape_once
This filter has been deprecated. You should use the json_encode filter instead. Encode a string to be used output as JSON. Unlike json_encode, if the string is null this will return an empty string instead.
for_json
{% for %}
Alias for escape, which encodes a string to be output as HTML. Although "h" is shorter, "escape" is preferred due to its improved readability and maintainability.
h
Decodes any encoded HTML entities (eg: &lt; becomes <)
html_decode
{{ html }}
Encode a string to be output as HTML. All special HTML characters will be converted to their equivalent HTML character entities (eg: < becomes <). This is functionally identical to the "escape" filter, though it may be more intuitive in some contexts - such as when using both the html_encode and html_decode filters to execute more advanced string manipulation.
html_encode
{{ html }}
Returns the 0-based location of the find string in the current string, or -1 if it cannot be found. If start is greater than 0, the search will begin at the specified index. To ignore capitalization, set ignorecase to true.
index: String findInteger startBoolean ignorecase
Decode a json encoded string
json_decode
Encode the input object to be used as a JSON property.
json_encode
Null values output the string "null". Dates are output using the ISO 8601 standard. Booleans are output as "true" or "false". Numbers are output as numbers. Strings are output as json encoded strings with quote marks properly escaped.
Returns the last 0-based location of the last occurrence of find string in the current string, or -1 if it cannot be found. If start is greater than or equal to 0, the search will begin at the specified index. To ignore capitalization, set ignorecase to true.
last_index: String findInteger startBoolean ignorecase
Removes whitespace from the beginning of a string
lstrip
Add <br /> tags in front of all newlines in the current string
newline_to_br
Adds the operand to the current value. Note that this filter behaves differently if the current value is a string
plus: Number operand
The plus filter may behave differently when used with string input. When used with a string input it may append text to the current value, although that behavior is deprecated and should be replaced by the append filter for optimal forward-compatibility.
Add text to the beginning of the input. If the input is not already a string it will be converted to one using the default behavior for its object type.
prepend: String text
Remove all occurrences of search from the current string.
remove: String search
Remove the first occurrence(s) of search from the current string.
remove_first: String searchInteger num_replacements
Replace all occurrences of search inside the current string with replacement
replace: String searchString replacement
Replace the first occurrence(s) of search inside the current string with replacement
replace_first: String searchString replacementInteger num_replacements
Replace all occurrences of pattern inside the current string with replacement using a regular expression - making it possible to search for more complicated expressions and replace using the resulting captured groups.
replace_regex: String patternString replacement
Replace the first occurrence(s) of pattern inside the current string with replacement using a regular expression - making it possible to search for more complicated expressions and replace using the resulting captured groups.
replace_regex_first: String patternString replacementInteger num_replacements
Reverses the input string or list.
reverse
When used with a string as input, the result is a string. Otherwise the result is a list.
Removes whitespace from the end of a string
rstrip
Returns the length of the input string or list.
size
If the input is not a string or list returns 0.
Return a part of the current string or list.
slice: Integer startInteger length
If the input is a string this will return a string. If it is a list it will return a list. Otherwise it will not do anything and will return the unaltered input.
Split a string into a list of substrings separated by the given separator
split: String separator
Removes whitespace from the beginning and end of a string
strip
Removes all HTML tags from a string
strip_html
This filter uses simple pattern matching to remove HTML tags. If the input is poorly formatted or contains unusual character sequences - particularly involving the '<' and '>' characters - this could result in unexpected behavior.
{{ html }}
Removes all newlines from a string
strip_newlines
Multiply the input by the operand.
times: Number operand
This filter currently behaves differently if the input is a string and the operand is an integer. In that case the result is a list of strings with input repeated operand times.
{{ time }}
Truncates a string down to length characters. If the original string is longer than length characters, the result will end with truncate_string.
truncate: Integer lengthString truncate_string
Truncates a string down to length characters. If the string would be broken in the middle of a word, ensures that the break happens either before or after the word. If the string is truncated it will end with truncate_string.
truncate_to_word: Integer lengthBoolean break_before_wordString truncate_string
The truncate_to_word uses a naive algorithm for word counting that considers words as one or more letters, digits, underscores, or apostrophes. All other characters are considered non-word characters in between words. This means that a string could still be truncated in the middle of a hypenated word or a word with other non-word characters such as "awe-inspiring", "r&r", "1.25", "3/4", etc.... This filter also does not strip or consolidate whitespace, or handle HTML markup any different than normal text.
Truncates the input string down to length words. If the input is longer than length words, appends truncate_string to the end of the truncated string.
truncate_words: Integer lengthString truncate_string
The truncate_words uses a naive algorithm for word counting that considers words as one or more letters, digits, underscores, or apostrophes. All other characters are considered non-word characters in between words. This means that hyphenated words such as "awe-inspiring" are counted as two words, as are "words" with other characters between letters, such as "r&r", "1.25", "3/4", etc.... This filter also does not strip or consolidate whitespace, or handle HTML markup any different than normal text.
Convert a string to uppercase
upcase
Decode a url encoded string.
url_decode: Boolean formdata
{% image_url %}
{{ url }}
{% set_canonical_url %}
Encode a string to be used in a URL.
url_encode: Boolean formdata
{% image_url %}
{{ url }}
{% set_canonical_url %}