From abcb0e29a36cbee9918de7af620cdbc80b9521ca Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Sun, 18 Aug 2019 16:46:54 +0530 Subject: [PATCH] Documentation for binary operators in where_exp (#7786) Merge pull request 7786 --- docs/_docs/liquid/filters.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/_docs/liquid/filters.md b/docs/_docs/liquid/filters.md index fafcd250..fbd9acdb 100644 --- a/docs/_docs/liquid/filters.md +++ b/docs/_docs/liquid/filters.md @@ -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