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
Example:
{{ 12345678|format_size }}

slugify

Returns a string slug for using as an URL segment.

Parameter Type Description Default
[return] string The slugified string
Example:
{{ "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
Example:
{{ 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.