Liquid has access to all common logical and comparison operators. These can be used in tags such as if and unless.

Basic Operators

== Equals
!= Does not equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
or Condition A or condition B
and Condition A and condition B

contains

contains tests for the presence of a substring within a string.

{% if page.title contains 'Product' %}
The title of this page contains the word Product.
{% endif %}

contains can also test for the presence of a string within an array of strings.

startswith

startswith tests whether a string starts with a given substring.

{% if page.title startswith 'Profile' %}
This is a profile page.
{% endif %}

endswith

endswith tests whether a string ends with a given substring.

{% if page.title endswith 'Forum' %}
This is a forum page.
{% endif %}