# Can't loop through posts on page other than index

**URL:** <https://forum.ghost.org/t/cant-loop-through-posts-on-page-other-than-index/30011>\
**Category:** Themes\
**Created:** [May 9, 2022, 9:24am UTC](https://forum.ghost.org/t/cant-loop-through-posts-on-page-other-than-index/30011 "2022-05-09T09:24:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nucker](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/nucker/32/13239_2.png) [@Nucker](https://forum.ghost.org/u/Nucker)\
**Post date:** [May 9, 2022, 9:24am UTC](https://forum.ghost.org/t/cant-loop-through-posts-on-page-other-than-index/30011/1 "2022-05-09T09:24:03Z")

</div>

I have this code here:

```auto
{{!< default}}
<div class="ms-index-container">
    <div></div>
    <div class="ms-postfeed">
        {{#foreach posts}}
            {{#if featured}}
                 <a href="{{url}}" class="ms-postcard">
                    <img src="{{img_url feature_image}}">
                    <h3>{{title}}</h3>
                    <p>{{date}}</p>
                </a>
            {{/if}}
        {{/foreach}}
    </div>
    <div></div>
</div>

```

And it works fine on my index.hbs, however on any other page it doesnt work. I just get blank nothing as if there are no posts.

---

<div class="post-metadata">

**Author:** ![SHAWNHOSEA](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/shawnhosea/32/17275_2.png) [@SHAWNHOSEA](https://forum.ghost.org/u/SHAWNHOSEA)\
**Post date:** [May 9, 2022, 10:52am UTC](https://forum.ghost.org/t/cant-loop-through-posts-on-page-other-than-index/30011/2 "2022-05-09T10:52:27Z")

</div>

On pages outside the `index.hbs`, I use the `get` helper to [fetch posts, pages, and tags](https://ghost.org/docs/themes/helpers/get/). For example, you’d wrap the #foreach helper with the get helper like so:

```auto
{{#get "posts"}}
    {{#foreach posts}}
        {{title}}
    {{/foreach}}
{{/get}}

```

I recently learned that using too many of these on one template can slow your page speed down, so you have to use them strategically.
