# Select a category in collections

**URL:** <https://talk.jekyllrb.com/t/select-a-category-in-collections/2592>\
**Category:** Help\
**Created:** [February 5, 2019, 2:16pm UTC](https://talk.jekyllrb.com/t/select-a-category-in-collections/2592 "2019-02-05T14:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lvdesign](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/lvdesign/32/1501_2.png) [@lvdesign](https://talk.jekyllrb.com/u/lvdesign)\
**Post date:** [February 5, 2019, 2:16pm UTC](https://talk.jekyllrb.com/t/select-a-category-in-collections/2592/1 "2019-02-05T14:16:39Z")

</div>

Hello,

Some problem to resolve a query when I try to use this code for a collections solution.

page.categories -\> is the result for the name of a category

For post page this kind of code is right and efficient :  
`{% for post in site.categories[page.categories] %}`

But I would like use this sentence for collections as 🙂  
`{% for product in site.products[page.categories] %}`

So in my head I think a “where” condition with filter will be 😊  
`{% assign sorted-products = site.products | where: "categories", page.categories %}`  
`{% for product in sorted-products %}`

Perhaps it’s impossible to execute this outside Post function ?

Thanks for an advice

Cordially

---

<div class="post-metadata">

**Author:** ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)\
**Post date:** [February 5, 2019, 5:17pm UTC](https://talk.jekyllrb.com/t/select-a-category-in-collections/2592/2 "2019-02-05T17:17:40Z")

</div>

I believe this isn’t possible in Jekyll’s current state.  
The way categories work with `site.posts` and collections isn’t the same.

The [inconsistencies are documented here](https://github.com/jekyll/jekyll/issues/7296)… I believe the goal is for Jekyll 4.0 to unify posts, pages, and collections so they behave similar.

---

<div class="post-metadata">

**Author:** ![lvdesign](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/lvdesign/32/1501_2.png) [@lvdesign](https://talk.jekyllrb.com/u/lvdesign)\
**Post date:** [February 5, 2019, 5:52pm UTC](https://talk.jekyllrb.com/t/select-a-category-in-collections/2592/3 "2019-02-05T17:52:35Z")

</div>

Hello mmistakes,

Thanks for the reply and this information.  
It will be great that we could use this principe in the futur (v4).

So I get back to my version using Post system.

🕶
