# How to get the current topic?

**URL:** <https://community.hubspot.com/t/how-to-get-the-current-topic/3951>\
**Category:** CMS Development\
**Created:** [November 20, 2017, 10:07am UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951 "2017-11-20T10:07:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jobnomade](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jobnomade/32/31184_2.png) [@jobnomade](https://community.hubspot.com/u/jobnomade)\
**Post date:** [November 20, 2017, 10:07am UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/1 "2017-11-20T10:07:05Z")

</div>

Dear community,

at the moment we have the set the blog title like this. This is the standard markup for a HubSpot blog.

```auto
<div class="cell-wrapper">
<h1>{{ group.public_title }}</h1>
</div>

```

However, we would like to add additional information to the content of the \<h1\> tag depending on the listing view. For example when the user visits topic “X” which filters only the posts for topic “X”. I would like the the topic “X” being displayed in the \<h1\> tag, in order to give the site visitor a proper information which topic has been selected and filtered.

Is there any HubL tag which can provide me with the current topic? So I can output the content?  
Thanks for your support.  
Kind regards,

Nhan

---

<div class="post-metadata">

**Author:** ![TRooInbound](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/trooinbound/32/89545_2.png) [@TRooInbound](https://community.hubspot.com/u/TRooInbound)\
**Post date:** [November 20, 2017, 12:05pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/2 "2017-11-20T12:05:46Z")

</div>

Hi @jobnomade,

Yes, this is possible without the use of Hubl code.

We are using in our projects and it’s working fine for us.

Just paste my javascript code in your edit head and it will work!

```auto
<script>
$(document).ready(function() {
 var url01 = window.location.href.split("tag/")[1];
 $('h1').text(url01.replace('-',' '))
});
</script>

```

Hope this work!

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/1/71232bb65bd029237c40010174d30ea2bb57cbd6.png) | Did my post help answer your query? Help the Community by **marking it as a solution**. |  
| — | — |

**TRooInbound Team**

For more help and solutions, please visit at [www.trooinbound.com](https://trooinbound.com/) or email at [hello@trooinbound.com](mailto:hello@trooinbound.com)

---

<div class="post-metadata">

**Author:** ![jobnomade](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jobnomade/32/31184_2.png) [@jobnomade](https://community.hubspot.com/u/jobnomade)\
**Post date:** [November 20, 2017, 12:20pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/3 "2017-11-20T12:20:31Z")

</div>

Thanks for your response.

This is a nice solution for the user with JavaScript enabled.

However, I wanted to avoid as well duplicated \<h1\> content and want to insert the topic here for search engines. I have an idea how to solve it with HubL. I will post it here as soon I have done some tests.

---

<div class="post-metadata">

**Author:** ![TRooInbound](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/trooinbound/32/89545_2.png) [@TRooInbound](https://community.hubspot.com/u/TRooInbound)\
**Post date:** [November 20, 2017, 2:30pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/4 "2017-11-20T14:30:34Z")

</div>

Hi @jobnomade,

Yes, We have some investigation and found the solution using Hubl code as well.

so now Our HubSpot Community has Two Solution using HubL code and using Javascript code! Both are working perfectly.

here is HubL code for your problem.

`{% if topic %}<h3>{{ page_meta.meta_description|replace(' | ', '') }}</h3>{% endif %}`

Hope this work!

Let’s see your solution and discuss!.

| ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/1/71232bb65bd029237c40010174d30ea2bb57cbd6.png) | Did my post help answer your query? Help the Community by **marking it as a solution**. |  
| — | — |

**TRooInbound Team**

For more help and solutions, please visit at [www.trooinbound.com](https://trooinbound.com/) or email at [hello@trooinbound.com](mailto:hello@trooinbound.com)

---

<div class="post-metadata">

**Author:** ![Jsum](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jsum/32/20405_2.png) [@Jsum](https://community.hubspot.com/u/Jsum)\
**Post date:** [November 20, 2017, 6:53pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/5 "2017-11-20T18:53:14Z")

</div>

@jobnomade,

No need for javascript.

the listing page actually has a variable for topic that is empty when not filtering by topic but is set to the topic filtered when filtering.

 ![HubL supported variables.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/a/ea365c073581d910536feec7e99dec9b7ad55211.png)  
You can do this:

```auto
<div class="cell-wrapper">
 <h1>
 {% if topic %}
 {{ topic }} 
 {% else %}
 {{ group.public_title }}
 {% endif %}
 </h1>
</div>

```

that will check if topic exists and if it does it will use the topic instead of the blog title

---

<div class="post-metadata">

**Author:** ![PDeT](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@PDeT](https://community.hubspot.com/u/PDeT)\
**Post date:** [January 11, 2022, 8:22pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/6 "2022-01-11T20:22:38Z")

</div>

How would this be done today? the {{ topic }} does not seem to be present on blog listing pages anymore? (it is not in the documentation about available variables either).

---

<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:** [January 12, 2022, 4:44pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/7 "2022-01-12T16:44:47Z")

</div>

@PDeT ,

Might take a look at **{{content.topic\_list}}**

---

<div class="post-metadata">

**Author:** ![PDeT](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@PDeT](https://community.hubspot.com/u/PDeT)\
**Post date:** [January 14, 2022, 7:21pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/8 "2022-01-14T19:21:10Z")

</div>

Well, no, that is not set on the topic listing page. It is a property for blog posts.

---

<div class="post-metadata">

**Author:** ![PDeT](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@PDeT](https://community.hubspot.com/u/PDeT)\
**Post date:** [January 13, 2022, 10:45pm UTC](https://community.hubspot.com/t/how-to-get-the-current-topic/3951/9 "2022-01-13T22:45:19Z")

</div>

that variable ‘topic\_list’ does not seem to be set on listing pages.
