Share Your Work

Top Contributor

Blog: custom title for blogs to fix SEO title too long issues

The problem. SEO tools flag blog posts with titles that are too long and sometimes you need your H1 headers to have that exact text on them.

Well a work around is to use the title on the settings as the title of the page and use a custom property to show in the H1 only for the blogs that need fixing.

First set the a variable and export it to the blog context

{% text "blog_display_title" label='Replace H1 content', export_to_template_context = True %}

Then in the body of the blog post template check if that value was set and then replace it or use the page title as your H1


{% if content.widgets.blog_display_title.body.value %}
            <h1>{{ content.widgets.blog_display_title.body.value }}</h1>
{% else %}
            <h1>{{ }}</h1>
{% endif %} 

Remember to check in the blog listing for this value too and replace it.


{% if not content.widgets.blog_display_title.body.value %}
     <h2 class="post-item--header"><a href="{{ content.absolute_url }}" class="link hubspot-editable" data-hubspot-form-id="name" data-hubspot-name="Blog Title">{{ }}</a></h2>
{% else %}
     <h2 class="post-item--header"><a href="{{ content.absolute_url }}">{{ content.widgets.blog_display_title.body.value }}</a></h2>
{% endif %} 
If this post helped you resolve your issue, please consider marking it as the solution. Thank you for supporting our HubSpot community.
1 Reply 1
Community Manager
Community Manager

Blog: custom title for blogs to fix SEO title too long issues

Hi @prosa 


This is a great post and very useful! Thank you for sharing this information 🙂 



Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !