else
Specify a default fallback block to render when all preceding if, elsif, unless, or case conditions are unmet.
Syntax
{% if condition %} ... {% else %} ... {% endif %}Example
{% assign count = 0 %}{% if count > 0 %}Items Available{% else %}No Items Found{% endif %}Output
No Items FoundThe else tag defines the default fallback branch inside an if, unless, or case construct. It executes only when preceding conditions evaluate to false or nil, guaranteeing that an informative fallback appears.
In keyword templates, else prevents thin content penalties from missing CSV attributes. For example, when displaying contact options: {% if row.phone %}<a href="tel:{{ row.phone }}">{{ row.phone }}</a>{% else %}<span>Online inquiry only</span>{% endif %}. This maintains high content quality across generated pages.
Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- where
- raw
- slugify
- number_format
