# Loop with filter categories

**URL:** <https://talk.jekyllrb.com/t/loop-with-filter-categories/2586>\
**Category:** Help\
**Created:** [February 4, 2019, 2:57pm UTC](https://talk.jekyllrb.com/t/loop-with-filter-categories/2586 "2019-02-04T14:57:45Z")\
**Posts on this page:** 2\
**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 4, 2019, 2:57pm UTC](https://talk.jekyllrb.com/t/loop-with-filter-categories/2586/1 "2019-02-04T14:57:45Z")

</div>

Hello  
I would like filtered category from a loop .  
My code return nothing when I write this code.  
I don’t find any kind of filter to find the right product.categories

My page 🙂`

```auto
---
layout: default 

---

<h1>{{ page.categories | capitalize }}</h1>
<ul>{% assign products = site.products[page.categories] %}
        {% for product in products %}        
            <li>
                <a href="{{ site.baseurl }}{{ product.url }}">{{ product.name }}</a>
                <small>	
                        {% for cat_name in product.categories %}
			<a href="{{ site.baseurl }}/categories/{{ cat_name }}/">{{ cat_name }}</a>
			{% endfor %}
		</small>
            </li>            
                {% else %}
            <p> Error -- Product empty </p>
        {% endfor %}
</ul>`

```

---

<div class="post-metadata">

**Author:** ![ark](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/ark/32/2559_2.png) [@ark](https://talk.jekyllrb.com/u/ark)\
**Post date:** [June 18, 2020, 2:56am UTC](https://talk.jekyllrb.com/t/loop-with-filter-categories/2586/2 "2020-06-18T02:56:11Z")

</div>

Did you ever get this to work?
