# How do I avoid showing duplicate posts on homepage?

**URL:** <https://forum.ghost.org/t/how-do-i-avoid-showing-duplicate-posts-on-homepage/17041>\
**Category:** Themes\
**Created:** [September 12, 2020, 12:00am UTC](https://forum.ghost.org/t/how-do-i-avoid-showing-duplicate-posts-on-homepage/17041 "2020-09-12T00:00:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![calvinpark](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/calvinpark/32/4882_2.png) [@calvinpark](https://forum.ghost.org/u/calvinpark)\
**Post date:** [September 12, 2020, 12:00am UTC](https://forum.ghost.org/t/how-do-i-avoid-showing-duplicate-posts-on-homepage/17041/1 "2020-09-12T00:00:18Z")

</div>

On the top, there are three pinned posts

```
{{! Top 3 pinned }}
<div class="h-cover home-banner u-marginAuto u-marginBottom30 u-clear">
    {{! Big left }}
    {{#get "posts" filter="tag:hash-pin1" include="tags" limit=1 as |post|}}
        {{#post}}{{> "story/story-cover" }}{{/post}}
    {{/get}}
    {{! Small right top }}
    {{#get "posts" filter="tag:hash-pin2" include="tags" limit=1 as |post|}}
        {{#post}}{{> "story/story-cover" }}{{/post}}
    {{/get}}
    {{! Small right bottom }}
    {{#get "posts" filter="tag:hash-pin3" include="tags" limit=1 as |post|}}
        {{#post}}{{> "story/story-cover" }}{{/post}}
    {{/get}}
</div>

```

Then there are four featured posts. Here, I filter out `hash-pin#` tags so that the four featured posts do not show a duplicate of the pinned posts.

```
{{! Show 4 featured posts in a grid }}
{{#get "posts" filter="featured:true+tag:-hash-pin1+tag:-hash-pin2+tag:-hash-pin3"
       include="tags,authors" visibility="all" limit=4}}
<div class="extreme-container home-story-grid">
    <div class="row u-marginBottom40">
        {{#foreach posts visibility="all"}}
            <div class="col col-s12 s6 m4 l3">
                {{! Story Grid - partiasl/story/story-grid.hbs }}
                {{> "story/story-grid" class='u-fontSize20'}}
            </div>
        {{/foreach}}
    </div>
</div>

```

Finally a list of 20 posts. This is where the problem is - I can’t figure out a way to filter out the 4 featured posts. If I filter out `featured:false`, it would hide all featured posts in the first 20 rather than just the 4 already listed above.

```
{{! Show the rest in a list }}
{{#get "posts" filter="tag:-hash-pin1+tag:-hash-pin2+tag:-hash-pin3"
       include="tags,authors" visibility="all" limit=@config.posts_per_page}}
<div class="extreme-container">
    <div class="row">
        <div class="col col-left story-feed">
            <div class="story-feed-content">
                {{#foreach posts visibility="all"}}
                    {{> "story/story-list"}}
                {{/foreach}}
            </div>
        </div>
        {{> "sidebar"}}
    </div>
</div>
{{/get}}

```

It’d be nice if there is an array that holds the IDs of the posts that were already displayed, which I would filter out on the bottom section.

Or is there a better way to do this? I think the pinned/featured/list is a pretty common pattern. I’m open to overhauling the current structure if there’s a BKM.

---

<div class="post-metadata">

**Author:** ![minimaluminium](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/minimaluminium/32/2652_2.png) [@minimaluminium](https://forum.ghost.org/u/minimaluminium)\
**Post date:** [September 12, 2020, 4:22am UTC](https://forum.ghost.org/t/how-do-i-avoid-showing-duplicate-posts-on-homepage/17041/2 "2020-09-12T04:22:51Z")

</div>

Hey @calvinpark,

If the 4 featured posts don’t usually get updated, you can filter by post IDs like:

```auto
{{#get "posts" filter="tag:-[hash-pin1,hash-pin2,hash-pin3]+id:-[ID1,ID2,ID3,ID4]"}}

```

Or if they get updated regularly, it might be a good option to use internal tags like you used for pinned posts.

---

<div class="post-metadata">

**Author:** ![calvinpark](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/calvinpark/32/4882_2.png) [@calvinpark](https://forum.ghost.org/u/calvinpark)\
**Post date:** [September 14, 2020, 5:18pm UTC](https://forum.ghost.org/t/how-do-i-avoid-showing-duplicate-posts-on-homepage/17041/3 "2020-09-14T17:18:59Z")

</div>

Thanks. Is there a way to mix JavaScript with HBS? Maybe collect the IDs in a JS array then use it on get filter to exclude?
