explain this code snippet

Someone to explain this line of code :

 <a href="{{ blog_author_url(group.id, content.blog_post_author.slug) }}">
 {{ content.blog_post_author.display_name }}

What does group.id do ?

And also,what does content.blog_post_author.slug do ?

Thank you all for your answers !

Hi @DOchieng,

this is a default blog author snippet which will display information from the blog post author.

group.id will get the unique blog id so the code/HubSpot knows at which blog to look at(since you can have multiple blogs it’s somekind of “placeholder”)

content.blog_post_author_slug will give you the slug/URL to the specific author who was selected as author in the specific post.

content.blog_post_author.display_name will print out the name of the author

Here’s a list of almost all possible blog related variables

hope that helps

best,

Anton

So the group.id is all the blogs written by the author in question , and
the content.blog_post_author.slug is the specific urls of the blogs ?
Still not getting it quite well

Almost correct

group.id defines a specific blog. For instance you have multiple blogs like “Main blog” “Product blog”…

As an example:

Anton_0-1678877170612.png

Each of these blogs got it’s own, unique id. This is what group.id is for

content.blog_post_author is getting the author information from the blog post in this specific blog which can be set in a blog post

Anton_1-1678877358593.png

the additional .slug suffix “tells” HubSpot to get the URL to the authors page. If you have set your blog as a subdomain (e.g https://blog.DOMAIN.com) it’s gonna be https://blog.DOMAIN.com/author/AUTHORNAME. If you’ve set the blog as a folder (e.g https://DOMAIN.com/blog) it’s gonna be https://DOMAIN.com/blog/author/AUTHOURNAME. So if your author is called “Jon Doe” the URL would be https://blog.DOMAIN.com/author/jon-doe or https://DOMAIN.com/blog/author/jon-doe

best

Anton

Hey Anton,

So assuming we click on the link with the author’s name,will it bring us to a page containing all the articles written by that author ??

Hi @DOchieng,

yes - that’s right.

If you want to modify the author layout it’s always theme related. So if you can’t find it, I would suggest to look into the theme documentation or reach out to the theme provider. If you’re using a HubSpot theme like “Growth” it’s located in the blog-listing.module (THEME/modules) between

{% if module.author and content.blog_author %}
{# layout of the author page #}
{% endif %}

best,

Anton

I think I’m settled now .

Thank you Antonn