Documentation for binary operators in where_exp (#7786)
Merge pull request 7786
This commit is contained in:
parent
c842d55cec
commit
abcb0e29a3
|
@ -118,6 +118,22 @@ You can use the `where` filter to detect documents and pages with properties tha
|
|||
{% raw %}{% assign filtered_posts = site.posts | where: 'my_prop', empty %}{% endraw %}
|
||||
```
|
||||
|
||||
### Binary operators in `where_exp` filter {%- include docs_version_badge.html version="4.0" -%}
|
||||
|
||||
You can use Liquid binary operators `or` and `and` in the expression passed to the `where_exp` filter to employ multiple
|
||||
conditionals in the operation.
|
||||
|
||||
For example, to get a list of documents on English horror flicks, one could use the following snippet:
|
||||
|
||||
```liquid
|
||||
{% raw %}{{ site.movies | where_exp: "item", "item.genre == 'horror' and item.language == 'English'" }}{% endraw %}
|
||||
```
|
||||
|
||||
Or to get a list of comic-book based movies, one may use the following:
|
||||
|
||||
```liquid
|
||||
{% raw %}{{ site.movies | where_exp: "item", "item.sub_genre == 'MCU' or item.sub_genre == 'DCEU'" }}{% endraw %}
|
||||
```
|
||||
|
||||
### Standard Liquid Filters
|
||||
|
||||
|
|
Loading…
Reference in New Issue