Skip to main content

Syntax for AND/OR in Liquid

Difficult to search the database on the words 'and' and 'or' so apologies if this is already answered somewhere. :)

I would like to exclude the top nav bar from multiple pages in our website, i.e., [%if page != page1 AND page != page2%]. What is the syntax for this? Could it be added to the FAQ?

Official response from

Sure thing, you can exclude the top nav on certain pages using the comparison and logic operators listed in our Liquid Basics documentation (which also includes examples).

Using your top nav example, you can use something like the following Liquid conditional:

{% if page.slug != 'page1' and page.slug != 'page2' %}
{% include "nav" %}
{% endif %}

If you need any assistance troubleshooting, feel free to email [email protected] with a link to the relevant file and a member of our theme support team will follow up.

Share this post

Showing 1 reaction

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.