# Filtering authors with zero posts

**URL:** <https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848>\
**Category:** Developer help\
**Created:** [December 11, 2020, 6:03pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848 "2020-12-11T18:03:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 6:03pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/1 "2020-12-11T18:03:39Z")

</div>

Hello,

I am building an authors list page and I need to get a list of authors with their post counts. I’m using the `#get` function helper with an include for the post counts. But the variable `count.posts` which I use to output post counts in the template doesn’t seem to be accessible using the `#has` helper function. Here’s my example:

```auto
{{#get "authors" limit="all" include='count.posts' order='count.posts desc'}}
    {{#foreach authors}}
        {{#count}}
            {{#has posts="0"}} ZERO POSTS {{/has}}
        {{/count}}

        Name: {{ name }}<br>
        Posts: {{count.posts}}
    {{/foreach}}
{{/get}}

```

Is there alternatively a way to filter authors with zero posts using an actual filter with the `#get` function helper?

Thanks for your help. I’m developing against `ghost:3.33-alpine`.

---

<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:** [December 11, 2020, 6:07pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/2 "2020-12-11T18:07:29Z")

</div>

You could try adding [a filter](https://ghost.org/docs/api/v3/content/#filtering) to the `{{get}}` helper…

```auto
{{#get "authors" limit="all" include="count.posts" order="count.posts desc" filter="count.posts:>0"}}

```

---

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 6:25pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/4 "2020-12-11T18:25:09Z")

</div>

Seems like `filter="count.posts:<1"` would filter all authors with zero posts, but it filters all authors.

```auto
{{#get "authors" limit="all" include='count.posts' order='count.posts desc' filter="count.posts:<1"}}

```

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [December 11, 2020, 6:35pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/5 "2020-12-11T18:35:44Z")

</div>

Correct me if I’m wrong, but isn’t an Author a user who has published at least 1 post? Or does the get helper allow fetching Users?

Also, I think filtering by `count.posts` is still [not supported](https://ghost.org/docs/api/v3/handlebars-themes/helpers/get/#limitations) in the get helper 😄

---

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 7:19pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/6 "2020-12-11T19:19:17Z")

</div>

I was under that impression too, but it appears that the account I used to create the blog with is listed as an author with 0 posts for all of the sites I’ve migrated to ghost.

---

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 7:34pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/7 "2020-12-11T19:34:24Z")

</div>

So there is no need to filter by 0 posts. The problem seems to be that ghost is adding the ghost owner user to the list of authors.

---

<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:** [December 11, 2020, 8:05pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/8 "2020-12-11T20:05:11Z")

</div>

> [@vikaspotluri123](#):
>
> Also, I think filtering by `count.posts` is still [not supported](https://ghost.org/docs/api/v3/handlebars-themes/helpers/get/#limitations) in the get helper 😄

Good point!

> [@NathanCobb](#):
>
> The problem seems to be that ghost is adding the ghost owner user to the list of authors.

Interesting, sounds like a bug if that’s reproducible!

Would something like this work in the meantime?

```handlebars
{{#get "authors" limit="all" include='count.posts' order='count.posts desc'}}
    {{#foreach authors}}
        {{#if count.posts}}
            Name: {{ name }}<br>
            Posts: {{count.posts}}
        {{else}}
            ZERO POSTS
        {{/if}}
    {{/foreach}}
{{/get}}

```

---

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 8:26pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/9 "2020-12-11T20:26:07Z")

</div>

This is exactly how I ended up solving it. I came back to update in case anyone else runs into this issue. The solution was `{{#if count.posts}}`. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [December 11, 2020, 8:35pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/10 "2020-12-11T20:35:53Z")

</div>

Are you by chance using the v2 API? In the `package.json` of the theme, is there a line that says

```json
    "engines": {
        "ghost-api": "v2"
    },

```

or something similar? I think the change happened in the v3 API which if I’m not mistaken is the theme API version

---

<div class="post-metadata">

**Author:** ![NathanCobb](https://avatars.discourse-cdn.com/v4/letter/n/439d5e/32.png) [@NathanCobb](https://forum.ghost.org/u/NathanCobb)\
**Post date:** [December 11, 2020, 8:52pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/11 "2020-12-11T20:52:45Z")

</div>

I’m using v3

```auto
"engines": {
        "ghost": ">=3.0.0",
        "ghost-api": "v3"
    },

```

---

<div class="post-metadata">

**Author:** ![truekasun](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/truekasun/32/20164_2.png) [@truekasun](https://forum.ghost.org/u/truekasun)\
**Post date:** [November 16, 2022, 5:57pm UTC](https://forum.ghost.org/t/filtering-authors-with-zero-posts/18848/12 "2022-11-16T17:57:20Z")

</div>

Is this still not supported? 🤔
