We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Filtering a collection in a partial

Kaz van Kooten October 8, 2020 by Kaz van Kooten

I have a collection of quotes. The quotee falls into a category: staff, client or ambassador.

Next, I have a partial that shows these quotes. Simplified, it looks like this:

{{ collection:quotes category:is = '{category}' }}
<div>
  <!-- Do something here -->
</div>
{{ /collection:quotes }}



Lastly, wherever I want to show the partial I've placed a line of code like so:

{{ partial:my-partial category='staff' }}



And that neatly filters the collection in the partial to all quotes of staff members.

However, there are instances where I would like to filter two or three categories. For example, show all entries that have the category staff and ambassador, but hide the ones marked client.

I've tried a couple of things, like {{ partial:my-partial category='staff | ambassador }}`, but that doesn't work.

What can I do to fix this?

>>>>>>> Unanswered <<<<<<<
4 Replies
2 Followers