Hide modules and sections from the editor

When developing a theme, you can set which modules and sections appear in the editor. This enables you to curate the list of modules and sections available to content creators when building pages, blogs, and global content, rather than having all modules and sections appear for all content types. Using this feature, you can also hide HubSpot default modules in favor of your own versions.

You can hide modules and sections in the following ways:

  • Within themes: you can hide default modules, but not custom modules. Similarly, you cannot hide custom sections in a theme. To exclude a custom module or section from a theme, you should instead delete the module or section from the theme.
  • Within templates: you can hide default modules, custom modules, and sections.

When hiding modules and sections, keep the following in mind:

  • When hiding HubSpot default modules in a template, ensure that the module is wrapped in single quotes ('). For example, '@hubSpot/follow_me'. This complies with YAML, which template annotations are based on.
  • You must use the relative path when specifying a hidden module. Using an absolute path will result in the module not being hidden.

Hide default modules in a theme

To hide all default modules, set hide_all_default_modules: true" in the theme.json file

To hide specific default modules in a theme, you'll need to add a list of hidden modules to a hidden_modules array in the theme.json file.

For example, if you wanted to hide HubSpot's default button and form modules from a theme, your code would look like the following:

// example theme.json { "label": "CMS Theme Boilerplate", "preview_path": "./templates/home.html", "screenshot_path": "./images/template-previews/home.png", "enable_domain_stylesheets": false, "license": "./license.txt", "responsive_breakpoints": [ { "name": "mobile", "mediaQuery": "@media (max-width: 767px)", "previewWidth": {"value": 477} } ], "hidden_modules": [ "@hubspot/button", "@hubspot/form" ] }

To hide all default modules, set hide_all_default_modules: true"  in theme.json.

Hide modules and sections in a template

To hide modules and sections in a specific template, you'll need to add a list of hiddenModules and hiddenSections in the template annotations. For example:

// example template file <!-- templateType: page isAvailableForNewContent: true label: Ticket listing screenshotPath: ../images/template-previews/ticket-listing.png hiddenModules: - '@hubSpot/follow_me' - ../modules/form hiddenSections: - ../sections/card -->

Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.