您可以在 assign Liquid 标签中使用两个 where 条件吗?
Can you use two where conditions in an assign Liquid tag?
可以使用两个 where
conditions in an assign
液体标签吗?
我在尝试 bundle exec jekyll serve --trace
:
时遇到此构建错误
Liquid Exception: Liquid error (line 7): wrong number of arguments (given 4, expected 3) in party/democratic/index.md
Error: Liquid error (line 7): wrong number of arguments (given 4, expected 3)
这是有问题的 Liquid 标签:
{% assign people = site.data.people | where: election_2020.office, 'U.S. President' and election_2020.party, 'Democratic' | sort: 'last_names' %}
无论您是否可以在 assign
标签中使用两个 where
过滤器,我都找不到任何文档。
PS:这是 people.yml
文件的示例:
-
id: 'julian-castro'
first_names: 'Julián'
last_names: 'Castro'
full_name: 'Julián Castro'
image: '/images/people/julian-castro-wikipedia.jpg'
gender: 'male'
image: '/images/people/julian-castro-wikipedia.jpg'
election_2020:
office: 'U.S. President'
address: 'P.O. Box 501'
latitude: '29.430018'
longitude: '-98.4987548'
city: 'San Antonio'
state: 'TX'
zip: '78292'
donate: 'https://secure.actblue.com/donate/julianforthefuture'
facebook: 'https://www.facebook.com/julianforthefuture/'
instagram: 'https://www.instagram.com/juliancastrotx/?hl=en'
twitter: 'https://twitter.com/JulianCastro'
website: 'https://www.julianforthefuture.com/'
party: 'Democratic'
election_type: 'primary'
source: 'https://voteinfo.utah.gov/2020-presidential-candidates/'
candidate_status: 'withdrew'
last_updated: '2020-02-20'
其中过滤器只允许将键值与另一个值进行比较。如果你想使用复杂的过滤,你可以使用 where_exp 过滤器。
{% assign people = site.data.people | where_exp: "someone", "someone.election_2020.office == 'U.S. President' and someone.election_2020.party == 'Democratic'" | sort: "last_names" %}
可以使用两个 where
conditions in an assign
液体标签吗?
我在尝试 bundle exec jekyll serve --trace
:
Liquid Exception: Liquid error (line 7): wrong number of arguments (given 4, expected 3) in party/democratic/index.md
Error: Liquid error (line 7): wrong number of arguments (given 4, expected 3)
这是有问题的 Liquid 标签:
{% assign people = site.data.people | where: election_2020.office, 'U.S. President' and election_2020.party, 'Democratic' | sort: 'last_names' %}
无论您是否可以在 assign
标签中使用两个 where
过滤器,我都找不到任何文档。
PS:这是 people.yml
文件的示例:
-
id: 'julian-castro'
first_names: 'Julián'
last_names: 'Castro'
full_name: 'Julián Castro'
image: '/images/people/julian-castro-wikipedia.jpg'
gender: 'male'
image: '/images/people/julian-castro-wikipedia.jpg'
election_2020:
office: 'U.S. President'
address: 'P.O. Box 501'
latitude: '29.430018'
longitude: '-98.4987548'
city: 'San Antonio'
state: 'TX'
zip: '78292'
donate: 'https://secure.actblue.com/donate/julianforthefuture'
facebook: 'https://www.facebook.com/julianforthefuture/'
instagram: 'https://www.instagram.com/juliancastrotx/?hl=en'
twitter: 'https://twitter.com/JulianCastro'
website: 'https://www.julianforthefuture.com/'
party: 'Democratic'
election_type: 'primary'
source: 'https://voteinfo.utah.gov/2020-presidential-candidates/'
candidate_status: 'withdrew'
last_updated: '2020-02-20'
其中过滤器只允许将键值与另一个值进行比较。如果你想使用复杂的过滤,你可以使用 where_exp 过滤器。
{% assign people = site.data.people | where_exp: "someone", "someone.election_2020.office == 'U.S. President' and someone.election_2020.party == 'Democratic'" | sort: "last_names" %}