Twig Filters
Herbie is using Twig Filters for modifying variables in layout and content files. The following filters are available.
format_size
Returns file size in a human readable format (B, KB, MB, GB, TB, PB).
Parameter | Type | Description | Default |
[return] | string | The file size in human readable format |
{{ 12345678|format_size }}
slugify
Returns a string slug for using as an URL segment.
Parameter | Type | Description | Default |
[return] | string | The slugified string |
{{ "A string with spaces, Umlauts or special characters (?!&#)."|slugify }}
visible
Filters the page tree by visible and active page items.
Parameter | Type | Description | Default |
[return] | pageTree | The filtered page tree |
{{ site.page_tree|visible }}
Built-in Filters
In addition to the filters mentioned above, Twig's built-in filters are of course also available. Please note that some of the filters may require the installation of additional Composer packages.
- abs
- batch
- capitalize
- column
- convert_encoding
- country_name
- currency_name
- currency_symbol
- data_uri
- date
- date_modify
- default
- escape
- filter
- first
- format
- format_currency
- format_date
- format_datetime
- format_number
- format_time
- html_to_markdown
- inline_css
- inky_to_html
- join
- json_encode
- keys
- language_name
- last
- length
- locale_name
- lower
- map
- markdown_to_html
- merge
- nl2br
- number_format
- raw
- reduce
- replace
- reverse
- round
- slice
- slug
- sort
- spaceless
- split
- striptags
- timezone_name
- title
- trim
- u
- upper
- url_encode