# explain this code snippet

**URL:** <https://community.hubspot.com/t/explain-this-code-snippet/77201>\
**Category:** CMS Development\
**Tags:** free\
**Created:** [March 15, 2023, 8:35am UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201 "2023-03-15T08:35:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DOchieng](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@DOchieng](https://community.hubspot.com/u/DOchieng)\
**Post date:** [March 15, 2023, 8:35am UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/1 "2023-03-15T08:35:17Z")

</div>

Someone to explain this line of code :

```auto
 <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 !

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [March 15, 2023, 9:34am UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/2 "2023-03-15T09:34:14Z")

</div>

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](https://developers.hubspot.com/docs/cms/hubl/variables#blog-variables)

hope that helps

best,

Anton

---

<div class="post-metadata">

**Author:** ![DOchieng](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@DOchieng](https://community.hubspot.com/u/DOchieng)\
**Post date:** [March 15, 2023, 10:26am UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/3 "2023-03-15T10:26:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [March 15, 2023, 11:18am UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/4 "2023-03-15T11:18:18Z")

</div>

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](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/f/6f16538f98805a92e05f1e54cc7eab3e95e27b92.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](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/b/3bd5193162f3b1cf0ba21e3dc207935a61e90dc7.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](https://blog.DOMAIN.com)) it’s gonna be https://_[blog.DOMAIN.com/author/AUTHORNAME](http://blog.DOMAIN.com/author/AUTHORNAME)_. If you’ve set the blog as a folder (e.g [https://DOMAIN.com/blog](https://DOMAIN.com/blog)) it’s gonna be [https://DOMAIN.com/blog/author/AUTHOURNAME](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](http://blog.DOMAIN.com/author/jon-doe) or [https://DOMAIN.com/blog/author/jon-doe](https://DOMAIN.com/blog/author/jon-doe)_

best

Anton

---

<div class="post-metadata">

**Author:** ![DOchieng](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@DOchieng](https://community.hubspot.com/u/DOchieng)\
**Post date:** [March 15, 2023, 12:40pm UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/5 "2023-03-15T12:40:59Z")

</div>

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 ??

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [March 15, 2023, 4:55pm UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/6 "2023-03-15T16:55:34Z")

</div>

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

```lia-code-sample
{% if module.author and content.blog_author %}
{# layout of the author page #}
{% endif %}

```

best,

Anton

---

<div class="post-metadata">

**Author:** ![DOchieng](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@DOchieng](https://community.hubspot.com/u/DOchieng)\
**Post date:** [March 15, 2023, 5:19pm UTC](https://community.hubspot.com/t/explain-this-code-snippet/77201/7 "2023-03-15T17:19:23Z")

</div>

I think I’m settled now .

Thank you Antonn
