CMS Development

benji_thecroc
Colaborador(a) | Parceiro Ouro
Colaborador(a) | Parceiro Ouro

Get blog authors from all blogs

Hi

 

I see there's a function blog_authors which enables you to get blog authors from a specific blog however is there a way to get blog authors from all blogs? We have 15 different blogs under one account so I don't particularly want to have to use this method as it would mean a lot of lines of code for something that should be relatively simple.

 

Thanks,

Benji

0 Avaliação positiva
2 Respostas 2
tjoyce
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

Get blog authors from all blogs

Thanks for the tag @jennysowyrda - Hi @benji_thecroc - 

While this does seem like it should be an easy function that exists in HS it is a lot more complicated behind the scenes. Blogs are meant to be descrete because it's far easier to merge data from multiple blogs than it is to sanitize data from multiple blogs. 

 

Something like this  (add your actual blog id's to the blogIds array)

  {% set authors = [] %}

  {% macro addAuthors(res) %}
    {% set authors = authors.append(res) %}
  {% endmacro %}
	

  {% set blogIds = ['XXXX210986', 'XXXXX9314986'] %}

  
  {% for id in blogIds %}
    {% for item in blog_authors(id, '250') %}
      {{addAuthors(item)}}
    {% endfor %}
  {% endfor %}
  
  {{authors|pprint}}

If this answer helped, please, mark as solved 😄


tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.

 

Drop by and say Hi to me on slack.

jennysowyrda
Gerente da Comunidade
Gerente da Comunidade

Get blog authors from all blogs

Hi @benji_thecroc,

 

Are you still looking for assistance with this matter? 

 

I found a few threads that speak to similar questions around blog authors. 

1. Display all blog authors@dennisedson@tjoyce have you found any solutions for this since originally posting?

 

2. Display only blog authors with one live post

 

Thank you,
Jenny

0 Avaliação positiva