# Exclude tags from home article list

**URL:** <https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009>\
**Category:** Themes\
**Created:** [March 20, 2021, 2:19pm UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009 "2021-03-20T14:19:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![uxerik](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/uxerik/32/11590_2.png) [@uxerik](https://forum.ghost.org/u/uxerik)\
**Post date:** [March 20, 2021, 2:19pm UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/1 "2021-03-20T14:19:53Z")

</div>

I am using the dawn theme and customised a few elements for my needs. I am using three main tags on my website: _work_, _blog_, and _about-me_. On home I need to exclude the tag _blog_ for the post list. I tried with the code below and it’s partially working. It’s excluding the tag _blog_ but at the same time it’s shower fewer articles for every blog entry with the tag _blog_. So what can I do to always show a fixed amount of posts?

```
<div class="content-area">
    <main class="site-main">
        <div class="post-feed container medium">
            {{#foreach posts}}
              {{#has tag="blog"}}
                  {{!-- show nothing nothing --}}
                  <p>1</p>
              {{else}}
                  {{> "loop"}}
              {{/has}}
            {{/foreach}}
        </div>
        {{pagination}}
    </main>
</div>
```

---

<div class="post-metadata">

**Author:** ![themeix](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/themeix/32/4472_2.png) [@themeix](https://forum.ghost.org/u/themeix)\
**Post date:** [March 21, 2021, 9:23am UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/2 "2021-03-21T09:23:03Z")

</div>

You can use the limit to set the post limit

```auto
{{#foreach posts limit="30"}}

```

Also the get helper could help you to filter the post properly.

> **[Ghost Handlebars Theme Helpers: get](https://ghost.org/docs/themes/helpers/get/)**
>
> Make custom queries to the Ghost API using the get helper and fetch publicly available data. Read more about Ghost themes! 👻

---

<div class="post-metadata">

**Author:** ![uxerik](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/uxerik/32/11590_2.png) [@uxerik](https://forum.ghost.org/u/uxerik)\
**Post date:** [March 21, 2021, 10:46am UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/3 "2021-03-21T10:46:33Z")

</div>

I tried that. But the problem still exists. If I have 30 new articles with the tag **blog** the list would give me 0 results.

---

<div class="post-metadata">

**Author:** ![brightthemes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/brightthemes/32/25099_2.png) [@brightthemes](https://forum.ghost.org/u/brightthemes)\
**Post date:** [March 21, 2021, 11:52am UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/4 "2021-03-21T11:52:32Z")

</div>

You could do that with the routes.yaml file, with the filter option.  
Then in your index you don’t have to check as all posts with blog should be excluded.

The “/” collection should look something like this:

```auto
collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[blog]

```

---

<div class="post-metadata">

**Author:** ![uxerik](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/uxerik/32/11590_2.png) [@uxerik](https://forum.ghost.org/u/uxerik)\
**Post date:** [March 21, 2021, 3:50pm UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/5 "2021-03-21T15:50:04Z")

</div>

This works perfectly. Thank you bironthemes! I am wondering about one thing. I fiddled around with the routes.yaml which is placed in my theme root. And it had no effect at all. But I discovered there is another routes.yaml in content/setttings and that worked. Does the routes.yaml within the theme root have no meaning at all?

---

<div class="post-metadata">

**Author:** ![brightthemes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/brightthemes/32/25099_2.png) [@brightthemes](https://forum.ghost.org/u/brightthemes)\
**Post date:** [March 21, 2021, 7:31pm UTC](https://forum.ghost.org/t/exclude-tags-from-home-article-list/21009/6 "2021-03-21T19:31:43Z")

</div>

No, the routes files in the theme root is usually for tracking the changes of that file.  
Whenever you change it you have to upload it in the Admin/Settings.
