[英]Liquid filter for not included in array?
我正在嘗試列出所有沒有標簽“ app”的頁面
這適用於帶有標簽應用程序的項目:
{% assign pages = site.pages | where:"tags",page.list_tag | where_exp:"page", "page.tags contains 'app'" | sort:"order_number" %}
但我不能使用“除非”:
{% assign pages = site.pages | where:"tags",page.list_tag | where_exp:"page", "unless page.tags contains 'app'" | sort:"order_number" %}
我收到此錯誤:
Liquid Exception: Liquid syntax error (line 2): Expected end_of_string but found id in /_layouts/list.html
我不認為這是可能的。 在這種情況下,我認為您必須循環瀏覽頁面,並在循環中包含一個unless
條件。 所以像這樣:
{% for page in site.pages %}
{% unless page.tags contains 'app' %}
{{ page.title }}
{% endunless %}
{% endfor %}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.