
Jinjava filters let you perform operations on values, such as rounding or formatting. If a filter has more than one parameter, the parameters are listed in the order they need to be provided.


<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

If you use Visual Studio Code as your editor, you can use code snippets to speed up working with inserts.  
You can find the snippets in our Github repository: [https://github.com/Synerise/jinja-code-snippet](https://github.com/Synerise/jinja-code-snippet)

</div></div></div>


## abs

Returns the absolute value of the argument.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to calculate the absolute value from |

**Example:**

<pre><code class="language-jinja">{% set my_number = -53 %}
{{ my_number|abs }} {#  returns 53  #}</code></pre>


## add

Adds a number to the existing value.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to which the variable/number in the parameters will be added |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | A number/variable |

**Example:**


<pre><code class="language-jinja">{% set my_num = 40 %}
{{ my_num|add(13) }} {#  returns 53  #}</code></pre>


## attr

Renders the attribute of a dictionary.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The dictionary that contains an attribute |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the attribute to render |

**Example:**

The filter example below is equivalent to rendering a variable that exists within a dictionary, such as content.absolute_url.


<pre><code class="language-jinja">{% set content = {'absolute_url': 'https://example.com'} %}
{{ content|attr('absolute_url') }}</code></pre>


Output:

<pre><code class="language-LANG">https://example.com</code></pre>


## base64 encode/decode

You can encode/decode values with base64.


<pre><code class="language-jinja">{% set foo = "example@synerise.com"|base64Encode %}

{{ foo }}
{#  returns ZXhhbXBsZUBzeW5lcmlzZS5jb20=  #}

{% set baz = foo|base64Decode %}

{{ baz }}
{#  returns "example@synerise.com"  #}</code></pre>


## batch

A filter that divides items in a list into groups.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| list | yes | A sequence or dict to apply the filter to |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number of items to contain in each group |
| string | no | The value used to fill in the positions of missing items |

**Example:**


<pre><code class="language-jinja">{% set items=[1, 2, 3, 4, 5] %}
&lt;table&gt;
    {%- for row in items|batch(3, 'xxx') -%}
    &lt;tr&gt;
        {%- for column in row -%}
        &lt;td&gt;{{ column }}&lt;/td&gt;
        {%- endfor -%}
    &lt;/tr&gt;
    {%- endfor -%}
&lt;/table&gt;</code></pre>


Output code:


<pre><code class="language-html">&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;1&lt;/td&gt;
        &lt;td&gt;2&lt;/td&gt;
        &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;4&lt;/td&gt;
        &lt;td&gt;5&lt;/td&gt;
        &lt;td&gt;xxx&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;</code></pre>


## bool

Converts a value into a boolean using strict conversion rules.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| any | yes | The value to convert into a boolean |


<div class="admonition admonition-warning"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z" /></svg></div><div class="admonition-body"><div class="admonition-content">

The `|bool` filter uses **stricter rules** than implicit boolean conversion, which is used in comparisons (`==`, `!=`), `{% if %}` conditions, and the `is truthy` test. The two approaches can return different results for the same input value — see the [example below](#bool-conversion-example).

</div></div></div>


**`|bool` conversion rules:**

| Input type | Returns `true` | Returns `false` |
| :--- | :--- | :--- |
| Boolean | `true` | `false` |
| Integer | `1` | All other integers, including `0` |
| Float | Never | Always, including `1.0` |
| String | `"true"` or `"1"` | All other strings |
| null | Never | Always |

**Implicit conversion rules** (used in `==`, `!=`, `{% if %}`, `is truthy`):

| Input type | Returns `true` | Returns `false` |
| :--- | :--- | :--- |
| Boolean | `true` | `false` |
| Number | Any non-zero number | `0` |
| String | Any non-empty string, except `"false"` | `""` (empty string) or `"false"` |
| null | Never | Always |
| Collection (list, map) | Non-empty | Empty |
| Any other type | Always | Never |

#### Bool conversion example

This example converts a string to a boolean using the `|bool` filter:


<pre><code class="language-jinja">{%- if "true"|bool == true -%}
    hello world
{%- endif -%}</code></pre>


The following example shows how `|bool` and implicit conversion can produce different results for the same input:


<pre><code class="language-jinja">{% set x = true %}
{% set y = 'string' %}

{% if x == y %}
  == {# implicit conversion: non-empty string → true, so true == true #}
{% else %}
  !=
{% endif %}

{% if x == y|bool %}
  ==
{% else %}
  != {# |bool: 'string' is neither 'true' nor '1' → false, so true != false #}
{% endif %}</code></pre>



<div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

For strict type-and-value equality without any boolean conversion, use the [`sameas` test](/developers/inserts/exptest#issameas). Unlike `|bool`, `sameas` checks that two values are identical objects without type coercion. For example, `"1" is sameas "true"` returns `false`, because `"1"` and `"true"` are different strings.

</div></div></div>


## capitalize

Capitalizes a value. The first character will be uppercase, all others lowercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string where the first character will be capitalized |

**Example:**


<pre><code class="language-jinja">{% set sentence = "the first letter of a sentence should always be capitalized." %}

{{ sentence|capitalize }}</code></pre>


## center

Uses whitespace to center the value in a field of a given width. This filter will only work in tags where whitespace is retained, such as `<pre>`.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to center |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The width of the field where the value will be centered |

**Example:**


<pre><code class="language-jinja">&lt;pre&gt;
    {% set var = "string to center" %}

    {{ var|center(80) }}
&lt;/pre&gt;</code></pre>


## count

Returns the number of items in a sequence or mapping.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The sequence/mapping to count |

**Example:**


<pre><code class="language-jinja">{% set services = ['Web design', 'SEO', 'Inbound Marketing', 'PPC'] %}

{{ services|count }}</code></pre>


## cut

Removes a string from the value of another string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The original string |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The sub-string to remove from the original string |

**Example:**


<pre><code class="language-jinja">{% set my_string = "Hello world." %}

{{ my_string|cut(' world') }}</code></pre>


## datetimeformat

Formats a datetime object and returns a string.

The datetime object can be generated with:
- [`iso8601_to_time`](#iso8601_to_time)
- [`timestamp_to_time`](#timestamp_to_time)
- [`strtotime`](#strtotime)


  <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  To get the current UTC time, you can use the `{{ iso_date }}` and `{{ timestamp }}` variables. These variables are initialized automatically; you don't need to declare them first.

  </div></div></div>


**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| datetime object | yes | The datetime object to format. |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The format of the date determined by the [directives](#datetimeformat-directives) added in this parameter. |
| string | no | Time zone (offset) of the output date. |

**Examples:**


<pre><code class="language-jinja">{% set iso_string = "2023-01-19T09:15:40+03:00" %}
{{ iso_string|iso8601_to_time|datetimeformat('%a, %B %d; %H:%M','-01:00') }}

{# outputs "Thu, January 19; 05:15" #}</code></pre>



<pre><code class="language-jinja">{{ 1721894790|timestamp_to_time|datetimeformat('%b %d, %Y; %H:%M') }}

{# outputs "Jul 25, 2024; 08:06" #}</code></pre>


### datetimeformat directives

The table lists the formatting directives you can use in the Synerise Jinjava implementation.

For the purpose of the "Example" column, the time is `2023-01-08T14:15:40.350+00:00`.



| Directive | Description                                    | Example                    |
| --------- | ---------------------------------------------- | -------------------------- |
| `%a`      | Weekday, abbreviated                           | `Sun`                      |
| `%A`      | Weekday, full                                  | `Sunday`                   |
| `%w`      | Weekday as number (Sunday is 1, Saturday is 7) | `1`                        |
| `%d`      | Day of the month, zero-padded                  | `08`                       |
| `%b`      | Month, abbreviated                             | `Jan`                      |
| `%B`      | Month, full                                    | `January`                  |
| `%m`      | Month as number, zero-padded                   | `01`                       |
| `%y`      | Year, without century, zero-padded             | `23`                       |
| `%Y`      | Year, with century                             | `2023`                     |
| `%H`      | Hour in 24-hour format, zero-padded            | `14`                       |
| `%I`      | Hour in 12-hour format, zero-padded            | `02`                       |
| `%p`      | AM/PM information                              | `PM`                       |
| `%M`      | Minutes, zero-padded                           | `15`                       |
| `%S`      | Seconds, zero-padded                           | `40`                       |
| `%f`      | Microseconds, zero-padded                      | `3500`                     |
| `%z`      | UTC offset                                     | `+0000`                    |
| `%Z`      | Timezone name (as GMT or GMT±....)             | `GMT`                      |
| `%j`      | Day of the year, zero-padded                   | `008`                      |
| `%U`      | Week number, Sunday as first day               | `02`                       |
| `%c`      | Date and time                                  | `Sun Jan 08 14:15:40 2023` |
| `%x`      | Date                                           | `01/08/23`                 |
| `%X`      | Time                                           | `14:15:40`                 |
| `%%`      | The `%` character, literal                     | `%`                        |

## default

If the value is null, it returns the passed default value, otherwise the value of the variable.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The variable to check |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to return when the variable is not defined |
| boolean | no | Set to `true` to use with variables which evaluate to false |

**Example:**


<pre><code class="language-jinja">// returns 'my_variable is not defined':

{% set my_variable = null %}
{{ my_variable|default('my_variable is not defined') }}

// returns 'Example string':

{% set my_variable2 = "Example string" %}
{{ my_variable2|default('my_variable is not defined') }}</code></pre>


If you want to use default with variables that evaluate to false you have to set the second parameter to true.


<pre><code class="language-jinja">{{ ''|default('the string was empty', true) }}</code></pre>


## dictsort

Sorts a dict and returns key-value pairs.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| dict | yes | The dict to sort |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| boolean | no | Defines if sorting is case-sensitive. Defaults to `false`. |
| string | no | Allowed values: `key`,`value`. Defines sorting by key or by value. Defaults to `key`. |

**Example:**

Sort the dict by value, case insensitive.


<pre><code class="language-jinja">{%- set contact = {
    'name': 'Alice',
    'email': 'alice@example.com',
    'phone': '123456789'
} -%}
{%- for item in contact|dictsort(false, 'value') -%}
    {{item}} &lt;/br&gt;
{%- endfor -%}</code></pre>


Output:

<pre><code class="language-LANG">email=alice@example.com
name=Alice
phone=123456789</code></pre>


## divide

Divides the current value by a divisor.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to be divided |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The divisor |

**Example:**


<pre><code class="language-jinja">{% set my_number = 106 %}

{{ my_number|divide(2) }}</code></pre>


## divisible

Evaluates to `true` if the value is divisible by the divisor provided in the parameter.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to be divided |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The divisor |

**Example:**

This example is an alternative to using the is [divisibleby expression test](/developers/inserts/exptest#isdivisibleby).


<pre><code class="language-jinja">{% set num = 10 %}

{%- if num|divisible(2) -%}
    The number is divisible by 2
{%- endif -%}</code></pre>


## escape

Converts the characters `&, <, >, ‘,`, and `”` in a string to HTML-safe sequences. Use this filter if you need to display text that might contain such characters in HTML. Marks the return value as a markup string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to escape |

**Example:**


<pre><code class="language-jinja">{% set escape_string = "&lt;div&gt;This markup is printed as text&lt;/div&gt;" %}

{{ escape_string|escape }}</code></pre>


## escape_jinjava

Converts the characters `{` and `}` in strings to Jinjava-safe sequences. Use this filter if you need to display text that might contain such characters in Jinjava. Marks the return value as a markup string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to escape |

**Example:**


<pre><code class="language-jinja">{% set escape_string = "{{This markup is printed as text}}" %}

{{ escape_string|escape_jinjava }}</code></pre>


## escapejs

Escapes strings so that they can be safely inserted into a JavaScript variable declaration.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to escape |

**Example:**


<pre><code class="language-jinja">{% set escape_string = "This string can safely be inserted into JavaScript" %}

{{ escape_string|escapejs }}</code></pre>


## escapejson

Escapes strings so that they can be used as JSON values.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to escape |

**Example:**


<pre><code class="language-jinja">{% set escape_string = "String that contains JavaScript" %}

{{ escape_string|escapejson }}</code></pre>


## filesizeformat

Formats raw file size in bytes into a human-readable format (for example, "13 kB", "4.1 MB", "102 bytes", and so on).

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The file size to format |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| boolean | no | Defines if binary prefixes (Mebi, Gibi) should be used. Defaults to `false`. |

**Example:**


<pre><code class="language-jinja">{% set bytes = 100000 %}

{{ bytes|filesizeformat }}</code></pre>


## first

Returns the first item of a sequence.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to process |

**Example:**


<pre><code class="language-jinja">{% set my_sequence = ['Item 1', 'Item 2', 'Item 3'] %}

{{ my_sequence|first }}</code></pre>


## float

Converts the value into a floating point number.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to convert into a float |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| float | no | The value to return if conversion fails. Defaults to `0.0`. |

**Example:**

This example converts a text field string value to a float.


<pre><code class="language-jinja">{% set my_text = "25.3" %}

{{ my_text|float }}</code></pre>


## forceescape

Enforces HTML escaping. 


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

This may double-escape variables.

</div></div></div>


**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The value to escape |

**Example:**


<pre><code class="language-jinja">{% set escape_string = "&lt;div&gt;This markup is printed as text&lt;/div&gt;" %}

{{ escape_string|forceescape }}</code></pre>


## format

Applies Python string formatting to an object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | String value to reformat |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string arguments | yes | Values to insert into the string |

**Example:**

`%s` can be replaced with other variables or values, for example `%d`.


<pre><code class="language-jinja">{{ "Hi %s %s"|format("Hello", "World!") }}</code></pre>


## fromjson

Deserializes data from a string. The string must be a serialized object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The JSON string to deserialize |

**Example:**

<pre><code class="language-jinja">{%- set y = '{"dataX":"b"}' -%}
{%- set deserialized = y|fromjson -%}
{{ deserialized }}</code></pre>


Output:

<pre><code class="language-LANG">{dataX=b}</code></pre>


### Using fromjson with arrays

To use `fromjson` with arrays, the array must be transformed into an object and then serialized with [tojson](#tojson).

Such a situation may occur when arrays are the result of macros or other inserts.

In the following example, the array is created for demonstration purposes:


<pre><code class="language-jinja">// Set the array:
{% set array = [{"a":9,"b":10},{"a":12,"b":15}] %}
// Put the array in an object:
{% set obj = { data:array } %}
// Serialize the object:
{% set json_obj = obj|tojson %}
// Deserialize the object with the array:
{% set transformed = json_obj|fromjson %}
{{ transformed['data'][0].a }}</code></pre>


The output is `9`

## groupby

Groups a sequence of objects by a common attribute.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| dict | yes | The dict to iterate over and group by a common attribute |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the common attribute to group by |

**Example:**

If you have a list of dicts or objects that represent persons with the attributes `gender`, `first_name`, and `last_name` attributes, you can group all the customers by gender this way:


<pre><code class="language-jinja">{%- set contents = [
    {'gender': 'male', 'name': 'John'},
    {'gender': 'female', 'name': 'Jane'},
    {'gender': 'male', 'name': 'Bob'},
    {'gender': 'female', 'name': 'Alice'}
] -%}

&lt;ul&gt;
    {%- for group in contents|groupby('gender') -%}
    &lt;li&gt;
        Group: {{ group.grouper }}
        &lt;ul&gt;
        {%- for content in group.list -%}
            &lt;li&gt;{{ content.name }}&lt;/li&gt;
        {%- endfor -%}
        &lt;/ul&gt;
    &lt;/li&gt;
    {%- endfor -%}
&lt;/ul&gt;</code></pre>


Output:

<pre><code class="language-html">&lt;ul&gt;&lt;li&gt;
male
&lt;ul&gt;&lt;li&gt;
    John
&lt;/li&gt;&lt;li&gt;
    Bob
&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;
    female
    &lt;ul&gt;&lt;li&gt;
        Jane
    &lt;/li&gt;&lt;li&gt;
        Alice
    &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;</code></pre>


## hash

Returns the SHA-256 hash of a string.


<pre><code class="language-jinja">{% set foo = "example@synerise.com"|hash("SHA-256") %}

{{ foo }}
{#  returns cab06d7019d42ed33dcb260dba8860f8028d243dd78184f3b5156d7bdae636dd  #}</code></pre>


## indent

Uses whitespace to indent a string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to indent |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The number of spaces. Defaults to 4. |
| boolean | no | If `true`, the first line will be indented. Defaults to `false`. |

**Example:**


<pre><code class="language-jinja">&lt;pre&gt;
    {% set var = "string to indent" %}

    {{ var|indent(2, true) }}
&lt;/pre&gt;</code></pre>


## int

Converts the value into an integer.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to convert into an integer |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | no | The value to return if conversion fails. Defaults to `0`. |

**Example:**

This example converts a text field string value to a integer.


<pre><code class="language-jinja">{% set my_text = "23" %}

{{ my_text|int }}</code></pre>


## iso8601_to_time

Converts an ISO date-time string to a datetime object, which should be further formatted with [`datetimeformat`](#datetimeformat).

**Input**
| Type | Required | Description |
| :--- | :--- | :--- |
| string | no<sup>*</sup> | An ISO date-time string. Can include a timezone. If the resulting object is printed directly, the timezone isn't displayed. You should use formatting to display the time in the correct timezones. See examples below.|

<sup>*</sup>An empty string applies the current time.

**Example**  

<pre><code class="language-jinja">{{ "2023-01-19T09:15:40+03:00"|iso8601_to_time }}
{# returns the following object:
2023-01-19 09:15:40
#}</code></pre>


Note that the timezone is not displayed, but it's saved as part of the object. To ensure that the timezone matches the one you want to display, declare it when formatting the time:

<pre><code class="language-jinja">{{ "2023-01-19T09:15:40+03:00"|iso8601_to_time|datetimeformat('%H:%M:%S','-01:00') }}
{# returns the string:
05:15:40
#}</code></pre>


For more details on formatting, see [`datetimeformat`](#datetimeformat).

## join

Returns a string which is the concatenation of the values in the sequence.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | A list of values to join |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | no | The separator. Defaults to empty string. |
| string | no | Dict object attribute to use in joining

**Example:**


<pre><code class="language-jinja">{%- set users = [
    {'username': 'john'},
    {'username': 'jane'},
    {'username': 'bob'}
] -%}

{{ users|join('|', attribute='username') }}</code></pre>


Output:

<pre><code class="language-LANG">john|jane|bob</code></pre>


It is also possible to join certain attributes of an object:


<pre><code class="language-jinja">{{ users|join('|', attribute='username') }}</code></pre>


## last

Returns the last item of a sequence.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to process |

**Example:**


<pre><code class="language-jinja">{% set my_sequence = ['Item 1', 'Item 2', 'Item 3'] %}

{{ my_sequence|last }}</code></pre>


## length

Returns the number of items in a sequence or mapping.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to process |

**Example:**


<pre><code class="language-jinja">{% set services = ['Web design', 'SEO', 'Inbound Marketing', 'PPC'] %}

{{ services|length }}</code></pre>


## list

Converts the value into a list. If it was a string, the returned list will be a list of characters.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | Value to split into a list |

**Example:**


<pre><code class="language-jinja">{% set one = 1 %}
{% set two = 2 %}
{% set three = 3 %}
{% set list_num = one|list + two|list + three|list %}

{{ list_num|list }}</code></pre>


## lower

Converts a value to lowercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to convert into lowercase |

**Example:**


<pre><code class="language-jinja">{{ "Text to MAKE Lowercase"|lower }}</code></pre>


## map

Applies a filter on a sequence of objects or looks up an attribute.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | Sequence to apply a filter to or a dict for attribute lookup |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| attribute pointer or string | yes | Filter to apply to the sequence or dict attribute to look up |

**Example:**

The basic usage is mapping by an attribute. Imagine you have a list of customers but you are only interested in a list of usernames.


<pre><code class="language-jinja">{%- set users = [
    {'username': 'john'},
    {'username': 'jane'},
    {'username': 'bob'}
] -%}
Users on this page: {{ users|map(attribute='username')|join(', ') }}</code></pre>


Output:

<pre><code class="language-LANG">Users on this page: john, jane, bob</code></pre>


Alternatively, you can let invoke a filter by passing the name of the filter and the arguments afterwards. A good example would be applying a text conversion filter on a sequence.


<pre><code class="language-jinja">{% set seq = ['item1', 'item2', 'item3'] %}

{{ seq|map('upper') }}</code></pre>


## md5

Calculates the MD5 hash of the given object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | Value for MD5 hash calculation |

**Example:**


<pre><code class="language-jinja">{% set content = {'absolute_url': 'https://example.com/page1'} %}
{{ content.absolute_url | md5 }}</code></pre>


Output:

<pre><code class="language-LANG">d22158c78143eeca7fa617577d741866</code></pre>



## multiply

Multiplies the current object with the given multiplier.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to be multiplied |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The multiplier |

**Example:**


<pre><code class="language-jinja">{% set n = 20 %}

{{ n|multiply(3) }}</code></pre>


## prettyprint

Pretty print a variable. Useful for debugging.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | Object to pretty print |

**Example:**


<pre><code class="language-jinja">{% set this_var = "Variable that I want to debug" %}

{{ this_var|pprint }}</code></pre>


## random

Returns a random item from the sequence.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | Sequence to return a random entity from |

**Example:**

The following example shows how to return the name of a random item from a recommendation:


<pre><code class="language-jinja">{% recommendations3 campaignId=CAMPAIGN_ID %}
    {% set randomItem = recommended_products3|random %}
    {{ randomItem.name }}
{% endrecommendations3 %}</code></pre>


## reject

Filters a sequence of objects by applying a [test](/developers/inserts/exptest) to the objects and excluding the ones that match the test.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to test |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the test to apply |

**Example:**


<pre><code class="language-jinja">{%- set some_numbers = [10, 12, 13, 3, 5, 17, 22] -%}

{{ some_numbers | reject('even') }}</code></pre>


Output:

<pre><code class="language-LANG">[13, 3, 5, 17]</code></pre>


## rejectattr

Filters a sequence of objects by applying a [test](/developers/inserts/exptest) to an attribute of an object and rejecting the objects that match the test.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to test |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the attribute to test |
| string | no | The name of the test to apply. Defaults to `'truthy'`. |

**Example:**

This loop rejects any post with the `content.post_list_summary_featured_image` attribute.


<pre><code class="language-jinja">{%- set contents = [
    {'title': 'Post 1', 'post_list_summary_featured_image': 'img1.jpg'},
    {'title': 'Post 2', 'post_list_summary_featured_image': ''},
    {'title': 'Post 3', 'post_list_summary_featured_image': null}
] -%}

{%- for content in contents|rejectattr('post_list_summary_featured_image') -%}
    {{content.title}} &lt;/br&gt;
{%- endfor -%}</code></pre>


Output:

<pre><code class="language-LANG">Post 2
Post 3</code></pre>


## replace

Returns a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument `count` is given, only the first `count` occurrences are replaced.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | Base string |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | String to replace |
| string | yes | The replacement value |
| number | no | This many first occurrences are replaced |

**Example:**


<pre><code class="language-jinja">{{ "Hello World"|replace("Hello", "Goodbye") }}</code></pre>



<pre><code class="language-jinja">{{ "aaaaargh"|replace("a", "d'oh, ", 2) }}</code></pre>


## reverse

Reverses the object or returns an iterator that iterates over it the other way round.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The sequence or dict to reverse |

**Example:**

<pre><code class="language-jinja">{% set nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] %}

{%- for num in nums|reverse -%}
    {{ num }}
{%- endfor -%}</code></pre>


## round

Rounds the number to a given precision.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number to round |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The precision of rounding (digits after decimal point). Defaults to 0. |
| string | no | The method of rounding. Allowed values: `ceil` (up), `floor` (down), `common` (down if `fraction < .5`). Defaults to `common`.

**Example:**


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Even if rounded to 0 precision, a float is returned. The fraction of that float is `.0`

</div></div></div>



<pre><code class="language-jinja">{{ 42.55|round }}</code></pre>



<pre><code class="language-jinja">{{ 42.55|round(1, 'floor') }}</code></pre>


If you need a real integer, pipe it through int.


<pre><code class="language-jinja">{{ 42.55|round|int }}</code></pre>


## select

Filters a sequence of objects by applying a [test](/developers/inserts/exptest) to the objects and only returning the ones that match the test.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to test |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the test to apply |

**Example:**


<pre><code class="language-jinja">{% set some_numbers = [10, 12, 13, 3, 5, 17, 22] %}

{{ some_numbers|select('even') }}</code></pre>


## selectattr

Filters a sequence of objects by applying a [test](/developers/inserts/exptest) to an attribute of an object and returning only the objects that match the test.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to test |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The name of the attribute to test |
| string | no | The name of the test to apply. Defaults to `'truthy'`. |

**Example:**  
This loop selects any posts containing content.post_list_summary_featured_image.


<pre><code class="language-jinja">{%- set contents = [
    {'title': 'Post 1', 'post_list_summary_featured_image': 'img1.jpg'},
    {'title': 'Post 2', 'post_list_summary_featured_image': ''},
    {'title': 'Post 3', 'post_list_summary_featured_image': null}
] -%}

{%- for content in contents|selectattr('post_list_summary_featured_image') -%}
    {{ content.title }}
{%- endfor -%}</code></pre>


Output:

<pre><code class="language-LANG">Post 1</code></pre>


## shuffle

Randomly shuffles a given list, returning a new list with all of the items of the original list in a random order.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to shuffle |

**Example:**  
The example below is a standard blog loop, with order randomized on page load.


<pre><code class="language-jinja">{%- for content in ['a','b','c','d','e']|shuffle -%}
    {{content}}
{%- endfor -%}</code></pre>


## slice

Slices an iterator and returns a list of lists containing those items.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence or dict to slice |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | yes | The number of slices to create |

**Example:**

Create a div containing three `<ul>` tags that represent columns.


<pre><code class="language-jinja">{% set items = ['laptops', 'tablets', 'smartphones', 'smart watches', 'TVs'] %}

&lt;div class="columwrapper"&gt;
    {%- for column in items|slice(3) -%}
    &lt;ul class="column-{{ loop.index }}"&gt;
        {%- for item in column -%}
        &lt;li&gt;{{ item }}&lt;/li&gt;
        {%- endfor -%}
    &lt;/ul&gt;
    {%- endfor -%}
&lt;/div&gt;</code></pre>


Output:

<pre><code class="language-html">&lt;div class="columwrapper"&gt;
    &lt;ul class="column-1"&gt;
        &lt;li&gt;laptops&lt;/li&gt;
        &lt;li&gt;tablets&lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul class="column-2"&gt;
        &lt;li&gt;smartphones&lt;/li&gt;
        &lt;li&gt;smart watches&lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul class="column-3"&gt;
        &lt;li&gt;TVs&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;</code></pre>


## sort

Sorts an iterable.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| iterable | yes | The sequence or dict to sort |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| boolean | no | If `true`, the sorting order is reversed. Defaults to `false`. |
| boolean | no | If `true`, sorting is case-sensitive. Defaults to `false`. |
| attribute | yes, if dict | If the input is a dict, this is the name of the attribute to sort by. |

**Example:**


<pre><code class="language-jinja">{%- for item in [4,7,1,9,3,4,7,2,8,4,5,6,7,9]|sort -%}
    {{item}}
{%- endfor -%}</code></pre>


## split

Splits the input string into a list on the given separator.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to split |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | no | The separator to split on. Defaults to a single space. (`' '`) |
| number | no | The splitting stops after this many occurrences, the remaining items become the last item in the resulting list. |

**Example:**


<pre><code class="language-jinja">{% set string_to_split = "Stephen; David; Cait; Nancy; Mike; Joe; Niall; Tim; Amanda" %}

{% set names = string_to_split|split(';', 4) %}

&lt;ul&gt;
    {%- for name in names -%}
    &lt;li&gt;{{ name }}&lt;/li&gt;
    {%- endfor -%}
&lt;/ul&gt;</code></pre>


## string

Returns the string value of an object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| value | yes | The value to return as a string |

**Example:**


<pre><code class="language-jinja">{% set number_to_string = 45 %}

{{ number_to_string|string }}</code></pre>


## striptags

Strips SGML/XML tags and replaces adjacent whitespace by one space.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | String to strip tags from |

**Example:**


<pre><code class="language-jinja">{% set some_html = "&lt;div&gt;&lt;strong&gt;Some text&lt;/strong&gt; &lt;/div&gt;" %}

{{ some_html|striptags }}</code></pre>


## strtotime

Transforms a string into a datetime object that can be processed with other filters, for example [`unixtimestamp`](#unixtimestamp) or [`datetimeformat`](#datetimeformat)

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | String to transform into a datetime object. |

**Parameters**
| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | Information about the format of the input. |

**Example:**
In this example, a US-format date is converted into datetime object.

<pre><code class="language-jinja">{% set date = "2025-24-08T14:31:30+0130"|strtotime("yyyy-dd-MM'T'HH:mm:ssZ") %}
{{date}}

{# returns the following object: 
2025-08-12 14:31:30
#}</code></pre>


Note that the timezone is not displayed, but it's saved as part of the object. To ensure that the timezone matches the one you want to display, declare it when formatting the time:

<pre><code class="language-jinja">{% set date = "2025-24-08T14:31:30+0130"|strtotime("yyyy-dd-MM'T'HH:mm:ssZ") %}
{{ date|datetimeformat('%H:%M:%S','-01:00') }}
{# returns the string:
12:01:30
#}</code></pre>


For more details on formatting, see [`datetimeformat`](#datetimeformat).

## sum

Returns the sum of a sequence of numbers plus the value of the `start` parameter (which defaults to 0). When the sequence is empty, it returns `start`.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| iterable | yes | A sequence or dict of values to sum |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The `start` parameter. Defaults to `0` |
| attribute | no | If the input is a dict, you can sum the values of an attribute. |

**Example:**


<pre><code class="language-jinja">{% set sum_this = [1, 2, 3, 4, 5] %}

{{ sum_this|sum }}</code></pre>


Sum up only certain attributes.


<pre><code class="language-jinja">Total: {{ items|sum(attribute='price') }}</code></pre>


## timestamp_to_time

Converts a Unix timestamp (seconds or miliseconds) to a datetime object, which should be further formatted with [`datetimeformat`](#datetimeformat).

**Input**
| Type | Required | Description |
| :--- | :--- | :--- |
| integer<sup>*</sup> | no<sup>**</sup> | The UNIX timestamp to transform. Timestamps are, by definition, in UTC. Don't recalculate them into other timezones when in the UNIX format, as this may cause problems in systems which treat it correctly as UTC. |

<sup>*</sup>The engine attempts parsing if you provide a string or a float, but this is not recommended.  
<sup>**</sup>An empty string applies the current time.

**Example**  

<pre><code class="language-jinja">{{ 1740042390|timestamp_to_time }}
{# returns the following object:
2025-02-20 09:06:30
#}</code></pre>


## title

Returns a titlecased version of the value. Words will start with uppercase letters, all remaining characters are lowercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to transform |

**Example:**


<pre><code class="language-jinja">{{ "My title should be titlecase"|title }}</code></pre>


## tojson

Serializes data into a JSON string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| various | yes | The data to transform into JSON |

**Examples:**

<pre><code class="language-jinja">{% set val = "b" %}
{% set x = {"dataX":val} %}
{{ x|tojson }}</code></pre>


Output:

<pre><code class="language-json">{"dataX":"b"}</code></pre>



<pre><code class="language-jinja">{% set object = {
  "field1": "value",
  "field2": {
    "subfield1": 1,
    "subfield2": [
      {
        "nestedObjectField1": "value",
        "nestedObjectField2": 1
      },
      {
        "nestedObjectField1": "value",
        "nestedObjectField2": 2
      },
      {
        "nestedObjectField1": "value",
        "nestedObjectField3": 3
      }
    ]
  }
} %}

{% set x = object|tojson %}
{{ x }}</code></pre>


Output:

<pre><code class="language-json">{"field1":"value",
"field2":{
    "subfield1":1,
    "subfield2":[{"nestedObjectField1":"value","nestedObjectField2":1},
                {"nestedObjectField1":"value","nestedObjectField2":2},
                {"nestedObjectField1":"value","nestedObjectField3":3}]
}}</code></pre>



<pre><code class="language-jinja">{% set qwe=[] %}
{% do qwe.append("123") %}
{% do qwe.append("456") %}
{{ qwe|tojson }}</code></pre>


Output:

<pre><code class="language-json">["123","456"]</code></pre>


## trim

Strips leading and trailing whitespace.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to transform |

**Example:**


<pre><code class="language-jinja">{{ " remove whitespace "|trim }}</code></pre>


## truncate

Returns a truncated copy of the string. The length is specified with the first parameter, which defaults to `255`. If the second parameter is `true`, the filter will cut the text exactly at the specified length. Otherwise, it will cut after the last complete word. If the text is actually truncated, the filter appends an ellipsis ("..."). If you want to replace the ellipsis with another string, provide that string as the third parameter.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to transform |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The number of characters to truncate after. Defaults to 255. |
| boolean | no | If `true`, the string is truncated exactly after the specified number of characters. Otherwise, the text is truncated after the last complete word. Defaults to `false`. |
| string | no | The string to append in the place where the text was truncated. Defaults to `'...'` |

**Example:**


<pre><code class="language-jinja">{{ "I only want to show the first sentence. Not the second."|truncate(48, True) }}
{#  I only want to show the first sentence. Not t...  #}

{{ "I only want to show the first sentence. Not the second."|truncate(48, False) }}
{#  I only want to show the first sentence. Not...  #}

{{ "I only want to show the first sentence. Not the second."|truncate(35, True, '[...]') }}
{#  I only want to show the first [...]  #}</code></pre>


## truncatehtml

Truncates a given string, respecting HTML markup (properly closes all nested tags).

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to transform |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The number of characters to truncate after. Defaults to 255. |
| string | no | The string to append in the place where the text was truncated. Defaults to `'...'` |
| boolean | no | If `true`, the string is truncated exactly after the specified number of characters. Otherwise, the text is truncated after the last complete word. Defaults to `false`. |

**Example:**


<pre><code class="language-jinja">{{ "&lt;p&gt;I want to truncate this text without breaking my HTML&lt;p&gt;"|truncatehtml(20, '..', false) }}</code></pre>


## unique

Extracts a unique set from a sequence of objects.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| sequence | yes | The sequence to filter |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| attr | no | If the input is a dict, you can use an attribute as the unique identifier. |

**Example:**

Filter duplicated strings from a sequence of strings.


<pre><code class="language-jinja">{{ ['foo', 'bar', 'foo', 'other']|unique|join(', ') }}
{#  foo, bar, other  #}</code></pre>


Filter out items with the same attribute.


<pre><code class="language-jinja">{% set contents = [
    {'post_list_summary_featured_image': 'img0.jpg', 'title': 'Post 2'},
    {'post_list_summary_featured_image': 'img1.jpg', 'title': 'Post 1'},
    {'post_list_summary_featured_image': '', 'title': 'Post 2'}
] %}
{%- for content in contents|unique(attr='title') -%}
    {{ content }} &lt;/br&gt;
{%- endfor -%}</code></pre>


Output:

<pre><code class="language-LANG">{post_list_summary_featured_image=img0.jpg, title=Post 2}
{post_list_summary_featured_image=img1.jpg, title=Post 1}</code></pre>


## unixtimestamp

Gets the UNIX timestamp value (in milliseconds) of a datetime object.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| object | yes | The datetime object to convert |

**Example:**

<pre><code class="language-jinja">{% set date = "2025-24-08T14:31:30+0130"|strtotime("yyyy-MM-dd'T'HH:mm:ssZ") %}
{{ date|unixtimestamp }}</code></pre>


Output:

<pre><code class="language-LANG">1756040490000</code></pre>


## upper

Converts a value to uppercase.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to convert into uppercase |

**Example:**


<pre><code class="language-jinja">{{ "text to make uppercase"|upper }}</code></pre>


## urlencode

Escapes strings for use in URLs (uses UTF-8 encoding). It accepts both dictionaries and regular strings, as well as pairwise iterables.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The URL to escape |

**Example:**


<pre><code class="language-jinja">{{ "Escape &amp; URL encode this string"|urlencode }}</code></pre>


## urlize

Converts URLs in plain text into clickable links.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | String URL to convert into anchor |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | Sets a character limit |
| boolean | no | If `true`, adds nofollow to the generated link. Defaults to `false`. |
| target | no | Adds a `target` attribute to the generated `<a>` tag. |

**Example:**

Links are shortened to 40 chars and defined with rel="nofollow".


<pre><code class="language-jinja">{{ "https://synerise.com"|urlize(40) }}</code></pre>


If target is specified, the target attribute will be added to the `<a>` tag


<pre><code class="language-jinja">{{ "https://synerise.com"|urlize(10, true, target='_blank') }}</code></pre>


## wordcount

Counts the words in the given string.

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to process |

**Example:**


<pre><code class="language-jinja">{%  set count_words = "Count the number of words in this variable" %}

{{ count_words|wordcount }}</code></pre>


## wordwrap

Returns a copy of the string passed to the filter wrapped after a number of characters (79 by default).

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| string | yes | The string to process |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| number | no | The number of characters to wrap after. Defaults to 79. |
| boolean | no | If `true`, long words will be broken when wrapped. Defaults to `true`. |

**Example:**


<pre><code class="language-jinja">&lt;pre&gt;
{{ "Lorem ipsum dolor sit amet, consectetur adipiscing elit"|wordwrap(10) }}
&lt;/pre&gt;</code></pre>


Output:
```
Lorem
ipsum
dolor sit
amet, cons
ectetur
adipiscing
elit
```

## xmlattr

Creates an HTML/XML attribute string based on the items in a dict.

Input:  
_(value = "dict", type = "dict", desc = "Dict to filter", required = true)_  
Params:  
_(value = "autospace", type = "boolean", defaultValue = "True", desc = "Automatically prepend a space in front of the item")_

**Input:**

| Type | Required | Description |
| :--- | :--- | :--- |
| dict | yes | The dict to process |

**Parameters:**

| Type | Required | Description |
| :--- | :--- | :--- |
| boolean | no | If `true`, automatically appends a space before the item. Defaults to `true`. |

**Example:**


<pre><code class="language-jinja">{% set html_attributes = {'class': 'bold', 'id': 'sidebar'} %}

&lt;div{{ html_attributes|xmlattr(False) }}&gt;&lt;/div&gt;
{#  &lt;divclass="bold" id="sidebar"&gt;&lt;/div&gt;  #}
&lt;div{{ html_attributes|xmlattr }}&gt;&lt;/div&gt;
{#  &lt;div class="bold" id="sidebar"&gt;&lt;/div&gt;  #}</code></pre>
