Twig Tests

On this page

Herbie is using Twig Tests for evaluating boolean conditions in layout and content files. In addition to the built-in tests of Twig, the following tests are available.

readable

Tests if the given alias or path exists and is readable.

Parameter Type Description Default
[return] bool
Example:
{% if "@site/data" is readable %}
  Path or file is readable
{% endif %}

writable

Tests if the given alias or path exists and is writable.

Parameter Type Description Default
[return] bool
Example:
{% if "@site/data" is writable %}
  Path or file is writable
{% endif %}