Twig Filters

Herbie is using Twig Filters for modifying variables in layout and content files. The following filters are available.


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 }}


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 }}


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.