Jekyll 如何使用';其中';带有';或';操作人员

Jekyll 如何使用';其中';带有';或';操作人员,jekyll,liquid,Jekyll,Liquid,我正在创建一个流动模板,在其中查找集合中给定元数据标记为“valueA”或“valueB”的文档 我尝试了以下方法: {% assign item = site.rn | where: "type", "typeA" OR "typeB" %} 上述示例均未返回type=typeA的项目和type=typeB的项目。前两个仅返回type=typeA的项目。第三个不返回任何内容,因为type=typeA和type=typeB没有任何项目。Edit 看来 正如您在问题下方的注释中所指出的,您可以在

我正在创建一个流动模板,在其中查找集合中给定元数据标记为“valueA”或“valueB”的文档

我尝试了以下方法:

{% assign item = site.rn | where: "type", "typeA" OR "typeB" %}
上述示例均未返回type=typeA的项目和type=typeB的项目。前两个仅返回type=typeA的项目。第三个不返回任何内容,因为type=typeA和type=typeB没有任何项目。

Edit 看来

正如您在问题下方的注释中所指出的,您可以在集合上循环,并根据if控件结构为数组提供数据

{% assign items = "" | split:"" %}

{% for item in site.rn %}
  {% if item.type == 'typeA' or item.type == 'typeB' %}
    {% assign items = items | push: item %}
  {% endif %}
{% endfor %}
结束编辑 这将在Jekyll 4中起作用 您可以尝试jekyll专用的“where_exp”液体过滤器()

似乎不支持“或”,括号也不支持。它返回错误:“应为dotdot,但找到了比较”//“应为\u字符串的\u结尾,但找到了id”
{% assign item = site.rn | where: "type", "typeA" | where: "type", "typeB" %}
{% assign items = "" | split:"" %}

{% for item in site.rn %}
  {% if item.type == 'typeA' or item.type == 'typeB' %}
    {% assign items = items | push: item %}
  {% endif %}
{% endfor %}
{% assign item = site.rn | where: "item", "item.type == 'typeA' or item.type == 'typeB'" %}