Hi,
I’m new to Jekyll and trying to filter a property by two values on an assign var.
Is it possible to have two where statements?
{% assign selected_colors = | where: “color.label” , “red” | where: “color.label” , “green” %}
Thanks
Hi,
I’m new to Jekyll and trying to filter a property by two values on an assign var.
Is it possible to have two where statements?
{% assign selected_colors = | where: “color.label” , “red” | where: “color.label” , “green” %}
Thanks
did you try using or
? not sure what it would look like, and can’t find an example like that.
Could you do an if statement above it and do the comparison there? I know you can use and
and or
there.
You may be able to achieve desired output by using the where_exp
filter:
{% assign selected_colors = all_colors | where_exp: "color", "color.label == 'red' or 'green'" %}