# Layout Page Not Using Variable

**URL:** <https://talk.jekyllrb.com/t/layout-page-not-using-variable/2771>\
**Category:** Help\
**Created:** [March 27, 2019, 10:14pm UTC](https://talk.jekyllrb.com/t/layout-page-not-using-variable/2771 "2019-03-27T22:14:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emre-k](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@emre-k](https://talk.jekyllrb.com/u/emre-k)\
**Post date:** [March 27, 2019, 10:14pm UTC](https://talk.jekyllrb.com/t/layout-page-not-using-variable/2771/1 "2019-03-27T22:14:27Z")

</div>

Hello,  
I’m trying to list tags for specific categories in Jekyll. For this, I have an index page for each category. All these pages have a different variable called “category” in their front matter. And they all use the same layout page. In the layout page, I’m running this code to filter tags in specific categories.

```
 {% for post in site.categories['{{page.category}}'] %}
    {% for tag in post.tags %}
     {{ tag }}
   {% endfor %}
 {% endfor %}

```

However this doesn’t work. If I change the [’{{page.category}}’] with the name of each category, it does what I need; but that defeats the purpose of using a layout.

I’m a total newbie in web programming and Jekyll, so apologies if this doesn’t make sense. Any help would be greatly appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![lego2019](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/lego2019/32/1724_2.png) [@lego2019](https://talk.jekyllrb.com/u/lego2019)\
**Post date:** [March 27, 2019, 10:39pm UTC](https://talk.jekyllrb.com/t/layout-page-not-using-variable/2771/2 "2019-03-27T22:39:01Z")

</div>

Did you try:

```auto
{% for post in site.categories[page.category] %}

```

---

<div class="post-metadata">

**Author:** ![emre-k](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@emre-k](https://talk.jekyllrb.com/u/emre-k)\
**Post date:** [March 27, 2019, 11:22pm UTC](https://talk.jekyllrb.com/t/layout-page-not-using-variable/2771/4 "2019-03-27T23:22:23Z")

</div>

I’ve tried a few different formats with the brackets but it looks like I’ve missed that one. It did the trick nicely - thanks a lot!
