leadstreet's technical blog

Suffering from HubSpot-bug related_blog_post? How to solve! (june 2020)

Written by Johan Vantomme | 12 June 2020

On 2 June 2020, we discovered a bug in the HubSpot HubL function, related_blog_post, which is currently messing up a lot of blogs. Find out if your blog is affected and how to solve it.

The bug is related to the related_blog_post function. That function allows you to list related blog posts to any blog post. It's quite a standard function, used in various HubSpot themes and by numerous HubSpot CMS developers.

How does that bug affect my blog?

The bug caused part of a script to be indexed by Google Search, resulting in hundreds of meaningless pages, thus ending up in search results. An example (notice the _hcms and related-blog-posts in the results):

When you click on such a link, you see an unstyled, incomplete page with a fraction of content from one of your blogs (see below). Which is not what you want, right?

The error was solved the same day (2 June 2020) by HubSpot - kudos for the team


But that fix does not prevent Google Search from having many of those indexed pages in its database. And it would be best if you remedied that.

How to solve

For our customers, we cleaned these "bad" pages from the Google Search results. Of course, not all HubSpot users are leadstreet customers 😃. That's why we'll explain the procedure here.

Step 1. Check if Google has indexed these specific pages

Enter site: mywebsite.com _hcms (replace mywebsite.com with your domain name) in Google and press enter.

  • No results? You are all set. The function is not used on your blog.
  • If you do see results, continue with step 2

Step 2. Clean your Google-results

HubSpot has already fixed the bug, so no action required there. What you should:

Adjust your robots.txt to prevent such pages from being indexed. Add to your robots.txt:

User-agent: *
Disallow: /_hcms*

  • Go to Google Search Console, then Removals, and add
  • Submit your request.
For our website, it took about 3 hours for the results to disappear in Google Search.

Questions about this (or about your HubSpot site)? Contact us. Happy to help you.