# Posts are not showing up on collection page

**URL:** <https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202>\
**Category:** Themes\
**Created:** [January 7, 2020, 12:52am UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202 "2020-01-07T00:52:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiyukoim](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hiyukoim/32/5655_2.png) [@hiyukoim](https://forum.ghost.org/u/hiyukoim)\
**Post date:** [January 7, 2020, 12:52am UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/1 "2020-01-07T00:52:55Z")

</div>

I’m building a template for my portfolio website.  
Oddly there’s no post showing up on `mywebsite.com/work/` page.  
The followings are my settings which might be related to this issue.  
I checked the HTML of the page but there {{#foreach posts}} to {{/foreach}} area doesn’t seem to be working.  
It would be great if you could point out some issue(s) I might overlook.

**routes.yaml**

```
routes
  /: home

collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index
  /work/:
    permalink: /work/{slug}/
    template: portfolio
    filter: tag:work
    data: tag.work

```

**portfolio.hbs**

```
<div class="site-content">	
	<div class="content-area">
	  <main class="site-main">
	    <div class="post-feed">
	      <div class="grid-item grid-sizer"></div>

		{{#foreach posts}}
		    {{#has tag="work"}}  	
		    	{{> portfolio-loop}}	
		    {{/has}}
		{{/foreach}}

    </div>
    {{pagination}}
  </main>
</div><!-- .content-area -->

```

**Tags on a post**

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/c/ca18deab67281a0ac0fd08511dfd9f55d7ceeb5d.png)

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [January 7, 2020, 10:28am UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/2 "2020-01-07T10:28:59Z")

</div>

Hi @hiyukoim 👋,

Could you try removing the line `data: tag.work` from your routes file, and removing `{{#has tag="work"}}` and `{{/has}}` from your portfolio template. Data isn’t needed and the `has` helper isn’t required as the `filter` value in the routes file is doing that for you 🙂

Edit: Sorry but I’ve just realised that you might be using the tag description and title for the page data. Please ignore the routes file change if you are doing this 😅

---

<div class="post-metadata">

**Author:** ![hiyukoim](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hiyukoim/32/5655_2.png) [@hiyukoim](https://forum.ghost.org/u/hiyukoim)\
**Post date:** [January 7, 2020, 12:20pm UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/3 "2020-01-07T12:20:40Z")

</div>

I found the solution for this issue so I want to share it with you and the community.  
It turned out that I didn’t add `#get` handlebar on **portfolio.hbs**.  
Also, I added `visibility="all"` to `#foreach` as I use membership access controls for some posts.

```
{{!-- The main content area on the portfolio page --}}
<div class="content-area">
  <main class="site-main">
    <div class="post-feed">
      <div class="grid-item grid-sizer"></div>
	{{#get "posts" include="tags" limit=@config.posts_per_page}}
		{{!-- The tag below includes the portfolio loop - partials/portfolio-loop.hbs --}}
	    {{#foreach posts visibility="all"}}
		    {{#has tag="work"}}
				{{> "portfolio-loop"}}
			{{/has}}
		{{/foreach}}
	{{/get}}
		{{pagination}}
	</main><!-- .site-main -->
</div><!-- .content-area -->

```

I didn’t come up with that idea without your suggestion, @DavidDarnes.  
After I tried your method and found out that was not it, I could get a clue where I should look into next.  
It’s a bit strange for me that I needed to use `#get` handlebar, because on another theme, it worked solely with `#foreach` to call a post loop.🤔

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [January 7, 2020, 2:40pm UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/4 "2020-01-07T14:40:01Z")

</div>

That’s great you got it working, and that I was able to help! However you are right, you shouldn’t need the `#get` helper here if you’re already using a custom collection and putting a filter on it 🤔. Maybe something else in the code is affecting it?

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 7, 2020, 3:51pm UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/5 "2020-01-07T15:51:55Z")

</div>

I think you’re running into the [“collections must be unique”](https://ghost.org/docs/api/v3/handlebars-themes/routing/tips/#collections-must-be-unique) restriction.

If you’re working with this config…

```yaml
collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index
  /work/:
    permalink: /work/{slug}/
    template: portfolio
    filter: tag:work
    data: tag.work

```

Ghost will see the `/blog/` collection first and because there’s no filter, all of your posts will be added to that collection. When it comes to the `/work/` collection, there are no posts left to put into to it.

To comply with the restriction you’d need to add a filter to your main `/blog/` collection so that your work posts don’t get included there, eg:

```yaml
collections:
  /blog/:
    permalink: /blog/{slug}/
    template: index
    filter: tag:-work
  /work/:
    permalink: /work/{slug}/
    template: portfolio
    filter: tag:work
    data: tag.work

```

If you do that then you should be able to get rid of the `{{#get}}` helper and the `{{#has tag="work"}}` conditional in your `portfolio.hbs` template.

Note, that if you’re using the `{{#get}}` helper in the way you’re currently doing it’s not fixing the collection problem - pagination won’t function and your “work” posts will continue to live on `/blog/{slug}/` rather than the `/work/{slug}/` URLs that you’ve specified.

---

<div class="post-metadata">

**Author:** ![hiyukoim](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hiyukoim/32/5655_2.png) [@hiyukoim](https://forum.ghost.org/u/hiyukoim)\
**Post date:** [January 7, 2020, 10:08pm UTC](https://forum.ghost.org/t/posts-are-not-showing-up-on-collection-page/11202/6 "2020-01-07T22:08:56Z")

</div>

Thank you for providing a better solution, @Kevin!  
I applied that change to my theme accordingly and it’s working!  
Also thank you so much for saving my time. With my solution, I would have run into the pagination issue you mentioned.
