Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for binary operators in where_exp #7786

Merged
merged 1 commit into from Aug 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/_docs/liquid/filters.md
Expand Up @@ -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

Expand Down