⚠️ Note that this post hasn't been updated for at least a year and the information may be outdated, proceed with caution! (Last updated: October 8, 2019)
When you click into a tag or topic (both words are used interchangeably) in your HubSpot blog, it'll take you to the "topic" page on which you might want to add a page title that shows the tag.
In a HubSpot blog template, the topic page is usually the same as your listings page but you can modify the header by using the if topic statement, like this:
{% raw %}{% if topic %}
{# Insert your code here #}
{% end if %}
Currently there is no straghtforward way to print out the tag of the page you're on (something like a "tag" variable), so what you will usually do is get the page's HTML title (page_meta.html_title
) which is a combination of the blog title you've set in your blog settings, a pipe symbol (|) and the tag name, something like:
My Super Awesome Blog | My Topic
And then remove everything before the pipe symbol. So in the case above, your code will look something like this:
{% if topic %}
Blog Topic: {{ page_meta.html_title|replace('My Super Awesome Blog | ', '') }}
{% end if %}
Which will print out:
Blog Topic: My Topic