Using {{if}} inside {{has}} returns only two posts


I am using Ghost v2.0 running in my local machine,

I have a static home page and I have created a news page which acts like a post listing page, I have used the following routes.yaml

  /: home

    permalink: /news/{slug}/
    template: news

  tag: /tag/{slug}/
  author: /author/{slug}/

I have to show 4 posts in this page and I have configured post_per_page as 4 in package.json and I don’t want to show the posts tagged slideshow and featured posts. But I am getting two posts only on the same page but I have 6 posts in total and on clicking the pagination I have to load two more posts.

{{#foreach posts}}
{{^has tag="slideshow"}}
{{^if featured}}
{{> "loop"}}

{{ pagination }} 

Is my helper syntax are correct or I am doing it wrong, Kindly assist me on the same.

Please find the screenshot below,


When you say I want 4 posts per page, Ghost gives you 4 posts, and it’s up to you how you display them. If you use filters, some of the posts might not ever be displayed. It sounds like 2 of the posts are either featured or have the slideshow tag. I think you can get the result you’re looking for by adding filters:


Thanks for your reply @vikaspotluri123

I am sure that I have only one featured post and 4 slideshow images which don’t have any other tag. I am using in the following way to eliminate tags,

{{^has tag="blankos, slideshow, social"}}

When I have one tag in it, it works perfectly, when I add two also it works perfectly but when I add the third tag, it is not working it does not display any posts.

Kindly assist me, Can I use multiple tags inside {{^has}} ? or is there any way to filter out the tags ?

I have used collections using routes.yaml, but it only filters the primary tag and I need to get all the posts filtering out the above tags (slideshow, blankos, social).


If you filter using tag:-[blankos,slideshow,social], that should filter based on any tag, not just the primary tag. Docs reference

You can:

I think you’ve already done this, but if you haven’t, you might want to ignore the filters and output all of the metadata about the posts in your template so you can see what data Ghost sees and make sure your logic is correct


It works perfectly !!!

closed #6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.