# Blog authors function only returning 3 author

**URL:** <https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166>\
**Category:** CMS Development\
**Created:** [August 17, 2022, 4:15pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166 "2022-08-17T16:15:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tajwar](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@Tajwar](https://community.hubspot.com/u/Tajwar)\
**Post date:** [August 17, 2022, 4:15pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/1 "2022-08-17T16:15:14Z")

</div>

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.

```lia-code-sample
{{ 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.

 ![Tajwar_0-1660752842080.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/8/48897f56a00e3b7fca588e13b9d74ac8f4c0a370.png)

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

---

<div class="post-metadata">

**Author:** ![BarryGrennan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/barrygrennan/32/97794_2.png) [@BarryGrennan](https://community.hubspot.com/u/BarryGrennan)\
**Post date:** [August 17, 2022, 7:34pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/2 "2022-08-17T19:34:12Z")

</div>

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.

* * *

 ![profile2022a.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/7/7273a34ccfe3489fceebc8a36eca751481b59531.jpeg)

**Barry Grennan**

[Freelance HubSpot CMS Developer](https://www.seoanseo.ca?utm_source=HubSpotCommunity)

[Website](https://www.seoanseo.ca?utm_source=HubSpotCommunity) | [Contact](https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity)

---

<div class="post-metadata">

**Author:** ![Tajwar](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@Tajwar](https://community.hubspot.com/u/Tajwar)\
**Post date:** [August 19, 2022, 2:34pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/3 "2022-08-19T14:34:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BarryGrennan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/barrygrennan/32/97794_2.png) [@BarryGrennan](https://community.hubspot.com/u/BarryGrennan)\
**Post date:** [August 19, 2022, 2:50pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/4 "2022-08-19T14:50:32Z")

</div>

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 😂 but I’ll be back in office this afternoon and can give you a sample code then

* * *

 ![profile2022a.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/7/7273a34ccfe3489fceebc8a36eca751481b59531.jpeg)

**Barry Grennan**

[Freelance HubSpot CMS Developer](https://www.seoanseo.ca?utm_source=HubSpotCommunity)

[Website](https://www.seoanseo.ca?utm_source=HubSpotCommunity) | [Contact](https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity)

---

<div class="post-metadata">

**Author:** ![Tajwar](https://avatars.discourse-cdn.com/v4/letter/t/f04885/32.png) [@Tajwar](https://community.hubspot.com/u/Tajwar)\
**Post date:** [August 19, 2022, 3:13pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/5 "2022-08-19T15:13:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BarryGrennan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/barrygrennan/32/97794_2.png) [@BarryGrennan](https://community.hubspot.com/u/BarryGrennan)\
**Post date:** [August 19, 2022, 7:07pm UTC](https://community.hubspot.com/t/blog-authors-function-only-returning-3-author/63166/6 "2022-08-19T19:07:19Z")

</div>

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:

```lia-code-sample
{% 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

```lia-code-sample
{% 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.

* * *

 ![profile2022a.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/7/7273a34ccfe3489fceebc8a36eca751481b59531.jpeg)

**Barry Grennan**

[Freelance HubSpot CMS Developer](https://www.seoanseo.ca?utm_source=HubSpotCommunity)

[Website](https://www.seoanseo.ca?utm_source=HubSpotCommunity) | [Contact](https://www.seoanseo.ca/#contact?utm_source=HubSpotCommunity)
