---
title: How to combine posts from multiple HubSpot blogs in a custom module
description: If you have multiple blogs on your HubSpot account, you may wish to create a module where you display posts from several of them.
---

[Skip to Content](https://www.stephanieogaygarcia.com/hubspot-website-development/how-to-combine-posts-from-multiple-hubspot-blogs-in-a-custom-module#main-content)

[![Stephanie O'Gay Garcia](https://www.stephanieogaygarcia.com/hubfs/Logos/stephanieogaygarcia_logo.svg "Stephanie O'Gay Garcia")](https://www.stephanieogaygarcia.com/)

Open Navigation

- [About](https://www.stephanieogaygarcia.com/about)
- [Services](https://www.stephanieogaygarcia.com/services)
- [Products](https://www.stephanieogaygarcia.com/shop)
- [Work](https://www.stephanieogaygarcia.com/portfolio-work)
- [Blog](https://www.stephanieogaygarcia.com/hubspot-website-development)
- [Contact](https://www.stephanieogaygarcia.com/contact)

- [About](https://www.stephanieogaygarcia.com/about)
- [Services](https://www.stephanieogaygarcia.com/services)
- [Products](https://www.stephanieogaygarcia.com/shop)
- [Work](https://www.stephanieogaygarcia.com/portfolio-work)
- [Blog](https://www.stephanieogaygarcia.com/hubspot-website-development)
- [Contact](https://www.stephanieogaygarcia.com/contact)

[HubSpot Sprocket Icon  HubSpot Website Development ](https://www.stephanieogaygarcia.com/hubspot-website-development)

[blog](https://www.stephanieogaygarcia.com/hubspot-website-development/tag/blog)

# How to combine posts from multiple HubSpot blogs in a custom module

 Technical Difficulty: Advanced

 Written by [ Stephanie O'Gay Garcia ](https://www.stephanieogaygarcia.com/hubspot-website-development/author/stephanie-ogay-garcia)

 First Published:  April 6, 2022

 Last Updated:  May 27, 2022

⚠️ Note that this post hasn't been updated for at least a year and the information may be outdated, proceed with caution! *(Last updated: May 27, 2022)*

If a HubSpot website has multiple blogs, you may wish to combine posts from all of them to display on your home page.

This is how I've approached this problem in the past.

## 1/ Create your module's fields

The first thing I do is create some editable fields on the custom module but, if you're hard coding this information, you can skip this step: 

- **Blogs**: this is a "Blog" type field, and I switch on the repeater so that the user can select multiple 
- **Tags (optional)**: this is a "Tags" type field, and I switch on the repeater as well so that the user can select multiple
- **Number of Posts**: this is a "Number" field where the user can select how many posts will be displayed overall (note the limitations in the "Notes" section below). I like to add this to the "Styles" tab 

This might look something like this for the Blogs and Tags fields (in both cases I've grouped the fields as well):

![hubspot-blog-and-tag-fields](https://www.stephanieogaygarcia.com/hs-fs/hubfs/HubSpot%20Website%20Development%20Post%20Images/hubspot-blog-and-tag-fields.jpg?width=300&name=hubspot-blog-and-tag-fields.jpg)

And like this for the Number of Posts field:

![hubspot-number-of-posts](https://www.stephanieogaygarcia.com/hs-fs/hubfs/HubSpot%20Website%20Development%20Post%20Images/hubspot-number-of-posts.jpg?width=300&name=hubspot-number-of-posts.jpg)

## 2/ Use HubL to combine blogs/tags

Under the HTML + HUBL field, the first thing I do is create an empty array (`all_posts`). 

### No Tags Field

If you haven't added a "Tags" field in Step 1 above, then you can use the following code to combine multiple blogs.

 

The code above:

- Creates an empty array `all_posts`
- Loops through all of the blogs selected in the blogs field (`module.blogs_to_display.blogs`)
- For each one, gets the recent posts (note the limitations in the "Notes" section below)
- For each recent post in that blog, it [appends](https://developers.hubspot.com/docs/cms/hubl/functions#append) it to the `all_posts` array

Notes: 

- If you are not using a "Blogs" field from step 1, create an array with your blog IDs and replace `module.blogs_to_display.blogs` with your array.
- If you are not using a "Number of Posts field from step 1, replace `module.style.general.number_of_posts` with the number of posts you would like to display

### Using a Tags Field

If you're using a "Tags" field, you can use a condition to check if the user has selected any tags (`if module.tags_to_display.tags|length > 0`). 

If so, the code within the condition is very similar to the above code to combine multiple blogs, but does so with the [blog_recent_tag_posts](https://developers.hubspot.com/docs/cms/hubl/functions#blog-recent-tag-posts) function. This is the full code snippet: 

 

Notes: 

- If you are not using a "Tags" field from step 1, create an array with your tags and replace `module.tags_to_display.tags` with your array
- If you are not using a "Blogs" field from step 1, create an array with your blog IDs and replace `module.blogs_to_display.blogs` with your array.
- If you are not using a "Number of Posts" field from step 1, replace `module.style.general.number_of_posts` with the number of posts you would like to display

## 3/ Display your posts

Now you can loop through your all_posts array and display your posts. 

 

In the example above:

- I've used `[:module.style.general.number_of_posts]` to limit the number fo posts. If you are not using a "Number of Posts" field from step 1, replace `module.style.general.number_of_posts` with the number of posts you would like to display
- I've used the HubL [sort](https://developers.hubspot.com/docs/cms/hubl/filters#sort) filter to sort the posts from newest to oldest. You can find a list of the properties that can be sorted on in [the blog posts API documentation](https://developers.hubspot.com/docs/api/cms/blog-post#filtering).

I've only included the post title above for brevity, but you can include as much post information as you'd like using [blog post variables](https://developers.hubspot.com/docs/cms/hubl/variables#blog-variables).

## Notes

Some items to note:

- The [blog_recent_posts](https://developers.hubspot.com/docs/cms/hubl/functions#blog-recent-posts) HubL function allows a maximum of 200 posts to be retrieved and can only be called 10 times per page
- The [blog_recent_tag_posts](https://developers.hubspot.com/docs/cms/hubl/functions#blog-recent-tag-posts) HubL function allows a maximum of 200 posts to be retrieved and can only be called 10 times per page.

If you found this helpful, buy me a coffee! ❤️

←  Previous Article

[Find the deals associated with a contact on a HubSpot membership page](https://www.stephanieogaygarcia.com/hubspot-website-development/find-the-deals-associated-with-a-contact-on-a-hubspot-membership-page)

Next Article  →

[Sort a HubDB query by date](https://www.stephanieogaygarcia.com/hubspot-website-development/sort-a-hubdb-query-by-date)

Contact

## Get help from a HubSpot CMS Expert

- Custom HubSpot themes and reusable and easy-to-use HubSpot templates and modules
- Technical support and guidance on the HubSpot CMS

[ Tell me about your project ](https://www.stephanieogaygarcia.com/project-details)

##### Contact

Need help with a HubSpot CMS project? Get in touch!

[Email](mailto:stephanie@stephanieogaygarcia.com) | [Contact](https://www.stephanieogaygarcia.com/contact)

##### About

- [ About ](https://www.stephanieogaygarcia.com/about)
- [ Portfolio ](https://www.stephanieogaygarcia.com/portfolio-work)
- [ LinkedIn ](https://www.linkedin.com/in/stephanieogaygarcia/)
- [ Facebook ](https://www.facebook.com/stephanieogaygarcia)
- [ Instagram ](https://www.instagram.com/stephanieogaygarcia/)

##### Services

- [ HubSpot Website Development ](https://www.stephanieogaygarcia.com/services/hubspot-website-development)
- [ HubSpot CMS Technical Support ](https://www.stephanieogaygarcia.com/services/hubspot-cms-technical-support)
- [ Custom HubSpot CMS Themes ](https://www.stephanieogaygarcia.com/custom-hubspot-cms-hub-themes)
- [ Pricing ](https://www.stephanieogaygarcia.com/services#pricing)

##### Latest Articles

- [How to add an llms.txt page to your HubSpot website](https://www.stephanieogaygarcia.com/hubspot-website-development/add-an-llmstxt-page-to-your-hubspot-website)
- [Switch an existing HubSpot custom module from global to local](https://www.stephanieogaygarcia.com/hubspot-website-development/switch-an-existing-hubspot-custom-module-from-global-to-local)
- [Overriding HubSpot's new forms styling from theme settings](https://www.stephanieogaygarcia.com/hubspot-website-development/overriding-hubspots-new-forms-styling-from-theme-settings)
- [All Articles](https://www.stephanieogaygarcia.com/hubspot-website-development)

---

 Copyright © 2018 - 2026 Stephanie O'Gay Garcia. All Rights Reserved.   
Freelance HubSpot CMS Developer based in Toronto, Canada 🇨🇦   
[Terms of Service](https://www.stephanieogaygarcia.com/terms-of-service) | [Website Terms of Use](https://www.stephanieogaygarcia.com/website-terms-of-use) | [Privacy](https://www.stephanieogaygarcia.com/privacy-policy) | [Cookies](https://www.stephanieogaygarcia.com/cookie-policy) | [LLMs](https://www.stephanieogaygarcia.com/llms.txt)

Scroll to Top

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.stephanieogaygarcia.com/#person",
  "@type" : "Person",
  "description" : "Freelance HubSpot CMS Developer specializing in custom HubSpot website development, themes, templates, and bespoke modules for small–mid sized B2B and SaaS companies.",
  "image" : "https://www.stephanieogaygarcia.com/hubfs/Logos/stephanieogaygarcia_logo.svg",
  "jobTitle" : "Freelance HubSpot CMS Developer",
  "knowsAbout" : [ "HubSpot CMS", "HubSpot themes", "HubSpot templates", "HubSpot modules", "HubDB", "Website migrations to HubSpot CMS", "Figma to HubSpot implementation" ],
  "name" : "Stephanie O'Gay Garcia",
  "sameAs" : [ "https://www.linkedin.com/in/stephanieogaygarcia/", "https://www.facebook.com/stephanieogaygarcia", "https://www.instagram.com/stephanieogaygarcia/", "https://ecosystem.hubspot.com/marketplace/solutions/stephanie-ogay-garcia/" ],
  "url" : "https://www.stephanieogaygarcia.com/",
  "worksFor" : {
    "@id" : "https://www.stephanieogaygarcia.com/#organization"
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.stephanieogaygarcia.com/#organization",
  "@type" : "Organization",
  "address" : {
    "@type" : "PostalAddress",
    "addressCountry" : "IE",
    "addressLocality" : "Dublin",
    "postalCode" : "A94"
  },
  "contactPoint" : {
    "@type" : "ContactPoint",
    "areaServed" : "Worldwide",
    "availableLanguage" : [ "en", "es" ],
    "contactType" : "sales",
    "email" : "stephanie@stephanieogaygarcia.com"
  },
  "description" : "Portfolio and business site of freelance HubSpot CMS Developer Stephanie O'Gay Garcia, based in Dublin, Ireland.",
  "logo" : "https://www.stephanieogaygarcia.com/hubfs/Logos/stephanieogaygarcia_logo.svg",
  "name" : "Stephanie O'Gay Garcia",
  "sameAs" : [ "https://www.linkedin.com/in/stephanieogaygarcia/", "https://www.facebook.com/stephanieogaygarcia", "https://www.instagram.com/stephanieogaygarcia/", "https://ecosystem.hubspot.com/marketplace/solutions/stephanie-ogay-garcia/" ],
  "url" : "https://www.stephanieogaygarcia.com/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@id" : "https://www.stephanieogaygarcia.com/#website",
  "@type" : "WebSite",
  "name" : "Stephanie O’Gay Garcia – Freelance HubSpot CMS Developer",
  "publisher" : {
    "@id" : "https://www.stephanieogaygarcia.com/#organization"
  },
  "url" : "https://www.stephanieogaygarcia.com/"
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Stephanie O'Gay Garcia",
    "url" : "https://www.stephanieogaygarcia.com/hubspot-website-development/author/stephanie-ogay-garcia"
  },
  "dateModified" : "2022-05-27T15:54:56.566Z",
  "datePublished" : "2022-04-06T20:13:08.000Z",
  "headline" : "How to combine posts from multiple HubSpot blogs in a custom module",
  "mainEntityOfPage" : {
    "@id" : "https://www.stephanieogaygarcia.com/hubspot-website-development/how-to-combine-posts-from-multiple-hubspot-blogs-in-a-custom-module",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.stephanieogaygarcia.com/hubfs/Logos/stephanieogaygarcia_logo.svg"
    }
  }
}
```