Reputation: 11
I'm creating a Liquid template where I look for documents within a collection where a given metadata tag is "valueA" OR "valueB".
I've tried the following:
{% assign item = site.rn | where: "type", "typeA" OR "typeB" %}
{% assign item = site.rn | where: "type", "typeA" "typeB" %}
{% assign item = site.rn | where: "type", "typeA" | where: "type", "typeB" %}
None of the above examples are returning both items where type=typeA AND items where type=typeB. The first two return only items where type=typeA. The third does not return anything because there are no items where type=typeA and type=typeB.
Upvotes: 1
Views: 464
Reputation: 52789
It seems that binary operator in where_exp
will not be supported before Jekyll 4.
As you've pointed in your comment under your question you can loop over your collection and feed an array depending on a if control structure.
{% assign items = "" | split:"" %}
{% for item in site.rn %}
{% if item.type == 'typeA' or item.type == 'typeB' %}
{% assign items = items | push: item %}
{% endif %}
{% endfor %}
You can try the jekyll specific `where_exp' liquid filter (see documentation).
{% assign item = site.rn | where: "item", "item.type == 'typeA' or item.type == 'typeB'" %}
Upvotes: 2