How to add categories for the HubSpot blog?

HubSpot supports tags for blog posts, there is no straight way to add categories for blogs in HubSpot, so to achieve that you need to create categories in the HubDB and assign the blog to those HubDB categories. Here are the steps:

Create the categories table in HubDB

Go to Marketing >> Files and Templates >> HubDB >> Create Table and enter the “Table label”, here we entered Categories

Categories table in HubDB

Once you create the table, you now add the row, which is the category name

HubDB add row categories

Click the “Add row” and enter the category name in the name column. Add multiple categories as per need.

Add category in HubDB

With these categories’ names in the HubDB, now let’s assign them to the HubSpot blog.

Assign categories to the HubSpot blog or article

To assign categories to the HubSpot blog, we are taking an approach by creating the module. For that, we create a module inside ThEMENAME >> modules >> webocreation_blog_categories_for_admin

New Module in Hubspot

In the right column of the module, add the field and search for the HubDB row

HubDB row in module

After that enter the name as categories, select the HubDB Table as Categories, Columns to Fetch as Name, Columns for the Choice label as Name, and enter the placeholder as “select a category”, the image is attached with settings:

Category field added

Likewise, enable the “Repeater Options”

Field repeaters in Hubspot

Now enter the following code in the module.html

{% for item in module.categories %}
	{{ item.columns.name }}
{% endfor %}
Module Code HubSpot blog categories

Now, add the module to the blog-post.html. Click the Publish changes on the blog post page. Our module code is like below, yours can be different. Just right-click the module and click “Copy snippet”

{% module "module_16805026947785" path="/hubspotblog/modules/webocreation_blog_categories_for_admin", label="webocreation_blog_categories_for_admin" %}
Category module to blog listing page

Now you are ready to assign the categories to the blog post. Create a new blog post and on the left side click the Content tab and you will see the module below:

Hubspot content tabs

Click the module as ours is webocreation_blog_categories_for_admin, we clicked it and see the following input field

Category add section

Click the “Add one” and select the category.

Category selected hubspot blog

You can select multiple categories and it will be shown below:

Category above title Hubspot blog

In this way, you can assign the category for the HubSpot blog, in our next post we will show you how to list the blog posts as per the category and list all blog posts of that category and add SEO data for the categories. Our approach will be to pull posts with hubdb_table_rows and filter queries so we will dig more and see if there are other ways also, so till then please have a look at our other Salesforce, Marketo, Pardot, and Hubspot articles and you can also find us on YoutubeTwitter, and Facebook. Please let us know if you have any questions or concerns.

We are HubSpot-certified developers based in Phoenix Arizona USA, so if you have any projects about HubSpot please let us know or you can email us directly at webocreation.com@gmail.com

Previous articleHow to show the author’s image in the blog post on Hubspot?
Next articleBuy Now Pay Later (BNPL) set up in Opencart Payment
Author of three Opencart book. The recent Opencart 4 book is at https://amzn.to/4dOlbOR

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here