# Featured post showing twice on index.hbs

**URL:** <https://forum.ghost.org/t/featured-post-showing-twice-on-index-hbs/2825>\
**Category:** Themes\
**Created:** [September 1, 2018, 10:09pm UTC](https://forum.ghost.org/t/featured-post-showing-twice-on-index-hbs/2825 "2018-09-01T22:09:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haydennyyy](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/haydennyyy/32/1388_2.png) [@haydennyyy](https://forum.ghost.org/u/haydennyyy)\
**Post date:** [September 1, 2018, 10:09pm UTC](https://forum.ghost.org/t/featured-post-showing-twice-on-index-hbs/2825/1 "2018-09-01T22:09:42Z")

</div>

With the following code, I get my styled featured post and then a second one after.  
{{!\< default}}

```
<div class="page-hwrap page-vwrap index">
  {{#foreach posts limit="5"}}
    {{#if featured}}
    <div class="post featured" style="
      {{#if feature_image}}
           background-image: url('{{img_url feature_image}}'); background-size: cover; background-position: center; background-repeat: no-repeat;">
      {{/if}}
        <div class="post--contents">
          <p class="post--is-featured">Featured Post</p>
          <h1 class="post--title">{{title}}</h1>
          <p class="post--author--date">By {{author}} on 23/07/2018</p>
          <p class="excerpt">{{excerpt}}</p>
        </div>
      </div>
    {{/if}}
    <div class="post">
      <div class="post--contents">
        <h1 class="post--title">{{title}}</h1>
        <p class="post--author--date">By {{author}} on 23/07/2018</p>
        <p class="excerpt">{{excerpt}}</p>
      </div>
    </div>
  {{/foreach}}
</div>

```

![image](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex015/uploads/ghost2/original/2X/8/8219241c784c60c6bd1396e46171ef46a01772b5.jpeg)

That is what happens. As you can see, “Welcome to Ghost” shows up twice. Someone help me out?

---

<div class="post-metadata">

**Author:** ![HauntedThemes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hauntedthemes/32/15301_2.png) [@HauntedThemes](https://forum.ghost.org/u/HauntedThemes)\
**Post date:** [September 1, 2018, 11:14pm UTC](https://forum.ghost.org/t/featured-post-showing-twice-on-index-hbs/2825/2 "2018-09-01T23:14:25Z")

</div>

That makes sense since you add the featured post and then add it again. Try this:

```auto
<div class="page-hwrap page-vwrap index">
  {{#foreach posts limit="5"}}
    {{#if featured}}
    <div class="post featured" 
      {{#if feature_image}}
           style="background-image: url('{{img_url feature_image}}'); background-size: cover; background-position: center; background-repeat: no-repeat;">
      {{/if}}
        <div class="post--contents">
          <p class="post--is-featured">Featured Post</p>
          <h1 class="post--title">{{title}}</h1>
          <p class="post--author--date">By {{author}} on 23/07/2018</p>
          <p class="excerpt">{{excerpt}}</p>
        </div>
      </div>
    {{else}}
    <div class="post">
      <div class="post--contents">
        <h1 class="post--title">{{title}}</h1>
        <p class="post--author--date">By {{author}} on 23/07/2018</p>
        <p class="excerpt">{{excerpt}}</p>
      </div>
    </div>
    {{/if}}
  {{/foreach}}
</div>

```

---

<div class="post-metadata">

**Author:** ![haydennyyy](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/haydennyyy/32/1388_2.png) [@haydennyyy](https://forum.ghost.org/u/haydennyyy)\
**Post date:** [September 2, 2018, 12:22pm UTC](https://forum.ghost.org/t/featured-post-showing-twice-on-index-hbs/2825/3 "2018-09-02T12:22:44Z")

</div>

Thanks, but I actually figured it out
