You bought a theme from the HubSpot Marketplace, or you started from a default HubSpot theme, and now you need to change a template, tweak a module or add your own CSS. Editing the original theme is often not possible (Marketplace and default themes are generally not editable) or risky (your changes and the vendor's updates collide). HubSpot's answer is the child theme. This guide explains what a child theme is, how to create one, how overriding really works, and the traps that catch most developers the first time.
What a child theme is
HubSpot describes a child theme as a copy of a parent theme that you can edit without altering the parent. You can create one from a default HubSpot theme, a Marketplace theme or one of your own custom themes, and you can edit the child even if the original theme is not editable. You can also change the child theme's theme settings without affecting the parent's settings.
The key idea is inheritance: every file in the parent is used by the child unless the child has its own file at the same relative path. You only keep in the child the files you actually changed.
What HubSpot creates for you (and what it does not)
When you create a child theme, HubSpot adds:
theme.jsonwith anextendsstatement that points to the parent themechild.cssandchild.js, two empty files for your child-specific styles and scripts- the files that contain the
standard_header_includesHubL variable (usually the base layout)
What it does not do is copy the parent's templates, modules, stylesheets or JavaScript. HubSpot's documentation is explicit: creating a child theme will not create clones of those assets; you clone the ones you want to change yourself. This is by design. If every file were copied, the child would stop receiving improvements from the parent.
Method 1: Create a child theme in the Design Manager
For a Marketplace or default HubSpot theme, HubSpot's Knowledge Base gives these steps:
- Go to Content > Design Manager.
- Open the @marketplace folder (Marketplace themes) or the @hubspot folder (default themes).
- Right-click the theme folder and choose Create child theme.
- Enter a name. Optionally click Change to pick a different file location, and expand Advanced options to rename the CSS and JS files.
- Click Create child theme.
For a custom theme in your own account, the developer docs describe creating a new blank theme in the Design Manager and then adding the extends line to its theme.json (shown below).
Method 2: Create a child theme with the HubSpot CLI
If you work locally with the HubSpot CLI, a child theme is a folder with a theme.json that contains extends. The value is the path of the parent theme. HubSpot's docs copy the parent's theme.json into a new folder and add one line; their example points to the default Barricade theme:
"extends": "@hubspot/barricade"
A minimal child theme.json could look like this (the label and preview path are illustrative; point preview_path at a real template):
{
"label": "Barricade Child - Acme",
"preview_path": "./templates/home.html",
"extends": "@hubspot/barricade"
}
A Marketplace theme lives under @marketplace/... and your own themes under their Design Manager path. Then upload the folder:
hs upload my-child-theme my-child-theme
Change the label to something clearly different from the parent, as HubSpot's developer blog recommends, so editors can tell the two apart in the theme picker.
How overriding works
To replace a parent file, put a file with the same relative path and the exact same file name in the child theme. HubSpot's docs use this example: to override
@marketplace/parent/theme/templates/about.html
create
/child/theme/templates/about.html
The same rule applies to modules, stylesheets, scripts, the base layout and fields.json. The child inherits the parent's fields.json by default, so only add one if you want to change the theme settings that editors see.
The "copy" trap
When you clone a file in the Design Manager, the new file name usually ends with "copy". HubSpot's developer blog warns that only exact-match file names release inheritance from the parent, so rename the clone to remove "copy". If you forget, your file sits unused next to the parent version and your change seems to do nothing.
Clone to child theme
For Marketplace themes in the Design Manager, HubSpot's developer blog describes a shortcut: right-click in the parent theme and choose Clone to child theme. For other themes, recreate the folder structure in the child and copy the file into the matching place, locally or in the Design Manager.
What to override and what to leave alone
| You want to change | Recommended approach |
|---|---|
| A few colors, spacing or small style fixes | Add rules to child.css. No parent file needs to be overridden. |
| Small behavior additions (tracking, a small script) | Add code to child.js. |
| The layout of one page template | Clone that template into the child at the same path and file name. |
| A module's markup or fields | Clone the module into the child at the same path, or build a new module with a different name if you want both versions. |
| The theme settings editors see | Add a fields.json to the child (otherwise the parent's is inherited). |
| Almost every file | Reconsider. A child theme that overrides everything gets no benefit from parent updates; for non-Marketplace themes, cloning the whole theme may be clearer. |
What happens when the parent theme is updated
This is the main reason to use a child theme. HubSpot's developer blog puts it simply: the child's files override the parent's, but remain unchanged when the parent theme is updated. In practice:
- Files you did not override keep coming from the parent, so they pick up the vendor's fixes and improvements.
- Files you overrode stay exactly as you left them. They do not receive the parent's changes to those files.
The second point is a responsibility. If the vendor fixes a bug in a template you overrode, you must bring that fix into your copy yourself. HubSpot also warns that parent changes can still affect your site's styling and behavior, so review the site after a parent update. Keeping overrides small and few makes those reviews quick.
Moving pages to the child theme
Once the child theme exists, it appears under Your themes when you create a new page. Existing pages do not switch on their own: HubSpot's docs say to change each page's template to the equivalent template from the child theme. Test this on an unpublished or staged page first.
Limits and restrictions
- No grandchildren. You cannot currently create a child theme from a child theme.
- Number of child themes. HubSpot's developer docs list 1 child theme for free tools and Starter, 5 for Professional and 10 for Enterprise. HubSpot renames and repackages its hubs from time to time, so check the current docs for your exact subscription.
- Marketplace themes cannot be cloned directly. HubSpot's Knowledge Base points to child themes as the way to customize them.
A practical checklist
- Create the child theme and give it a clear label.
- Put small style and script changes in
child.cssandchild.jsfirst. - Override a template or module only when CSS is not enough, and keep the exact path and file name (remove "copy").
- Keep a short list of every file you overrode and why, so you know what to check after a parent update.
- Test on an unpublished page, then switch live pages to the child templates one at a time.
- After each parent update, compare your overridden files with the new parent versions and review the site.
Sources
- HubSpot Developers: Child themes
- HubSpot Knowledge Base: Use themes (section on child themes)
- HubSpot Developers Blog: Customize your site with a child theme
- HubSpot Developers: Themes overview (theme.json)
