unless Tag

The inverse of if: only execute code if a certain condition is not met.

Description

unless is the inverse of if. It executes a block of code if a certain condition is not met.

      {% unless current_page.home? %}
        {% include 'breadcrumbs' %}
      {% endunless %}
      

You can also use elsif and else tags within an unless block, though we find that using if blocks are usually easier to understand in that case.

Parameters

None.