How to use multiple arguments in an if statement with Liquid
25,619
Another way you can condense this is to combine else if statements, and booleans don't necessarily need the "==" when evaluating true:
{% if include.featured and product.featured %}
{% assign test = true %}
{% elsif include.featured == false and product.featured == false %}
{% assign test = false %}
{% endif %}
Author by
Fisu
Updated on July 02, 2020Comments
-
Fisu almost 4 years
I want to use an
if
statement in Liquid with multiple conditionals. Something like:{% if (include.featured == "true" and product.featured == "true") or (include.featured == "false" and product.featured == "false") %}
Multiple conditionals don't seem to work. Have I got the syntax wrong or can Liquid not handle this sort of if statement?
-
Ron over 8 yearselseif is spelled elsif for jekyll - otherwise this was helpful to me.