{% assign posts = site.posts | where_exp:"item","item.languages contains lang and not (item.category_list contains 'adult')" | sort: 'users' | reverse %}
Liquid Exception: Liquid syntax error (line 55): Expected end_of_string but found id in index.md
Error: Liquid syntax error (line 55): Expected end_of_string but found id
Error: Run jekyll build --trace for more information.
I’m not in front of the computer to test this, but given you are still trying to make it work, I believe you can just add another where_exp. If I’m not mistaken, Liquid will process your filters from left to right. So instead of doing the AND, just do your first where_exp and then do the second.
Jekyll Feed: Generating feed for posts
Liquid Exception: Liquid syntax error (line 113): Expected end_of_string but found id in index.md
Error: Liquid syntax error (line 113): Expected end_of_string but found id
Error: Run jekyll build --trace for more information.
Removing the not parses correctly, so I’m assuming the not keyword is causing the problem.
I’m currently just using an if to filter out the results, like this:
I am back and did some research on this. There is no easy way to do what you are asking for. There is no not contains feature in Jekyll. You could do a != for exact matches, but that would mean you have to match a particular string, not an array of strings. Would it be possible for you to move the category_list elements to additional YAML data elements? Maybe you could more clearly articulate why you are doing this we can come up with a different solution?
So, I have posts which contain a set of categories under category_list.
For every category, I iterate over that list and display posts for that category. The code for this is here.
Additionally, when displaying posts for a category, I want to avoid posts which contain a particular category, for example “adult”. This is to avoid displaying 18+ posts. To achieve this, I’m currently using an if check as on Line 125.
The above code combining for and if is technically correct and working, but it would be a lot neater if I could combine both in a single expression.
Okay, I see the code and understand where you are coming from. Since adult content is a unique element to your site and [could potentially?] spread across any type of category, my best suggestion is to create a new YAML front matter element.