Inconsistent post count for author in author.hbs template and get helper


#1

I have a custom author archive page custom-author-archive.hbs where I use {{get}] helper to show all authors and their related info. Content of that file is like below.

{{#get "users" limit="all" include="count.posts" order="count.posts desc"}}
{{#foreach users}}
    ........ 
    some more code here
    ........
    <a href="{{url}}"><span class="post-count">{{t "Total"}} {{plural count.posts empty=(t "0 Post") singular=(t "1 Post") plural=(t "% Posts")}}</span></a>
    ........
    some more code here
    ........
{{/foreach}}
{{/get}}

In author.hbs file i have following code.

{{#author}}
    ........ 
    some more code here
    ........
    {{plural ../pagination.total empty=(t "No posts") singular=(t "1 post") plural=(t "% posts")}}
    ........ 
    some more code here
    ........
{{/author}}

Now the problem is in custom author archive page it shows author x have 5 post but in author page, it shows that same author x have 8 post.

I think the cause is in custom author archive the post count number shows the post count where this author X is primary author.
But in author page (author.hbs ) the post count number shows the post count where this author X is an author, no matter the author is primary or not.

Now I want to have same post count in author archive page ( get helper ) as it shows in author page (author.hbs).


#2

Yeah true. count.posts currently only counts posts where the author is primary - as you already self-discovered.

And the author page shows all posts, where the author is primary or not, which is correct. That looks inconsistent.

I have raised an issue https://github.com/TryGhost/Ghost/issues/9822

Thanks for the report :ghost:


#3

Thank @Kate for the reply. and raising the issue. Hope it will be solved soon.

BTW I am very exited with ghost 2. You guys doing splendid job. :+1:
I am also updating all my Ghost 1 compatible theme to Ghost 2 as fast as possible.


#4

The fix for this bug was released in 2.1.0 :slight_smile:


#5