Blog authors function only returning 3 author

I am trying to fetch all the blog authors with blog_authors(“default”, 250) function, but this is only returning 3 authors. I am using that in a module. Here is my full code.

{{ blog_authors("default", 20) }}

{% set my_authors = blog_authors("default", 250) %}
<ul>
{% for author in my_authors %}
<li><a href="{{ blog_author_url(group.id, author.slug) }}">{{ author }}</a></li>
{% endfor %}

I also tried this with Hubspot CMS Api which is returning the correct result. I am attaching a screenshot of the result here.

Also apology, had to hide some contents because of privacy issues.

Are all of those authors on your “default” blog?

My guess would be the api is getting all authors for the entire portal

{% set my_authors = blog_authors(“default”, 250) %} only pulls in authors from the default blog.


Barry Grennan

Freelance HubSpot CMS Developer

Website | Contact

Thanks for helping me. Can you tell me how can I get authors from all blogs together?

Hi @Tajwar,

I don’t believe there is a native way to do it.

What you’d do is set a blog_authors call for each blog id then set a variable that combined them like “set combined = (authors1 + authors2)”

Of course you might also need to create an array from that to weed out duplicates that may be authors on both blogs.

I’m on my mobile right now, so writing the code would take me forever :joy: but I’ll be back in office this afternoon and can give you a sample code then


Barry Grennan

Freelance HubSpot CMS Developer

Website | Contact

I was trying to do the same thing. However, it seems unique / union doesn’t work. Maybe there is some kind of underlying object which is preventing it from detecting same author from different blog.

So, the issue is that John Smith author on blog A and John Smith author on blog B are unique.

If you look at the JSON it spits out, it’s the livePosts value that causes the issue.
Here’s a simplified version of adding the Author names to an array if it’s unique:

{% set my_authors1 = blog_authors(34471392197, 250) %}
{% set my_authors2 = blog_authors(59761752650, 250) %}
{% set all_authors = (my_authors1 + my_authors2)|sort(False, False, "display_name") %}
{% set unique_authors = []%}

{% for author in all_authors %}
{% unless author.display_name in unique_authors %} 
 {% do unique_authors.append( author.display_name ) %}
{% endunless %}
{% endfor %}

Now that’s simply just an array of their names. If you want the other author info it’s going to get more complicated.
I tried playing around with

{% unless author.display_name in unique_authors|??????? %} 
 {% do unique_authors.append( author ) %}
{% endunless %}

trying to figure out how to search inside the nested arrays of the unique_authors array using attr and the like but I’m not coming up with anything.


Barry Grennan

Freelance HubSpot CMS Developer

Website | Contact