Set your HubSpot topic or tag page title

    Difficulty Level: Intermediate. This post assumes a solid understanding of HubSpot tools and some technical knowledge. Instructions are detailed and can be applied as they appear on the post.

    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

    Written by: Stephanie O'Gay Garcia Last Updated: October 8, 2019

    Thank you! I appreciate the feedback 😊

    Sorry to hear that! 🙁

    I'd appreciate if you could take a moment to let me know how I can improve this article.

    New call-to-action

    Looking for a HubSpot website developer?

    Let me help you with website themes, templates, page setup and custom modules. 

    Get in touch

    Stephanie O'Gay Garcia

    Hi! 👋 I'm a freelance HubSpot Website Developer based in Toronto (Canada). Give me a shout if you have questions about this post or there's anything I can help you with.