# Display all blog authors using a custom module

**URL:** <https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334>\
**Category:** CMS Development\
**Created:** [September 21, 2018, 2:16pm UTC](https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334 "2018-09-21T14:16:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [September 21, 2018, 2:16pm UTC](https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334/1 "2018-09-21T14:16:43Z")

</div>

Hello friends!

I am struggling to get the correct syntax to display a single entry for each author who has a post. I am able to print an array with all post authors, but it duplicates authors in my list and that just isnt cool. I am trying to use the “unique” filter, but i must not be selecting the correct attribute?

here is the code:

```auto
{% set blog = blog_recent_posts('6035003896') %}
{% set news = blog_recent_posts('5989572231') %}
{% set contents = (news + blog)|unique('blog_author.display_name') %}
<ul>
 {% for content in contents %}
 <li>{{ content.blog_author.display_name }}</li>
 {% endfor %}
</ul>

```

explain what i am doing incorrectly, hubl gods

as always,

thanks,

d

---

<div class="post-metadata">

**Author:** ![tjoyce](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tjoyce/32/88832_2.png) [@tjoyce](https://community.hubspot.com/u/tjoyce)\
**Post date:** [September 21, 2018, 2:58pm UTC](https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334/2 "2018-09-21T14:58:59Z")

</div>

@dennisedson - Maybe someone else has a creative way to solve this feature but I don’t see it. I believe the blog\_recent\_posts stores a reference to the blog object, not the object itself. I think that happens once it enters the for loop.

And since for loops are Scoped, good luck attempting to store “used authors” outside of the for loop in an array and checking against them.

---

<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 18, 2022, 3:36am UTC](https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334/3 "2022-08-18T03:36:38Z")

</div>

I know this post is years old but I came across it today as a suggestion from an unrelated post. And as it turns out I think I have a solution that works for this 🤣  
I did this for a client last year. It was convoluted to figure out and there may be some simpler way I’m overlooking. But I’ll post it none the less for posterity in case anyone else comes across this post.

@dennisedson I hope you found a solution before now! 🙂

```lia-code-sample
{% set my_authors = blog_authors(34471392197, 250) %}
{% set rec_posts = blog_recent_posts(34471392197, 200) %}

{% set recent_author_array = []%}

 {% for rec_post in rec_posts %}
 {% unless rec_post.blog_post_author.slug in recent_author_array %} 
 {# Append to array if it is not #}
 {% do recent_author_array.append( rec_post.blog_post_author.slug ) %}
 {% endunless %}
{% endfor %}

<ul>
 {% for author in my_authors %} 
 {% if author.slug in recent_author_array %}
 {% for rec_post in rec_posts|selectattr('blog_post_author.slug', 'equalto',author.slug) %}
 {% if loop.index == 1 %}
 <li>{{ author.display_name }} <a href="{{ rec_post.absolute_url }}">latest article</a></li>
 {% endif %}
 {% endfor %}
 {% endif %}
 {% endfor %}
</ul>

```

* * *

 ![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:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [August 19, 2022, 11:44pm UTC](https://community.hubspot.com/t/display-all-blog-authors-using-a-custom-module/10334/4 "2022-08-19T23:44:12Z")

</div>

Look at @BarryGrennan over here, quietly becoming a legend. Thank you for sharing 🙌
