在 Liquid 模板中搜索数组中的匹配项时,如何调用完全包含
?例如,如果某个页面的标签可能包含 separable
或 non-separable
,那么如何找到仅包含 separable
而不是包含 separable
的页面不可分离
标签?根据我的经验,{% if post.tags contains 'separable' %}
语句会考虑这两种情况。
最佳答案
请参阅 documentation 你可以使用这个过滤器
{% assign tags = post.tags | where:"tag","separable" %}
关于jekyll - Liquid 中有没有办法使用 contains 运算符来检查精确匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39414308/