Learn how to override HubSpot’s system meta tags and safely customize the <head> in your templates without breaking tracking or core functionality.
When developing custom templates in HubSpot CMS, developers often face a common limitation: the section is partially controlled by the platform.
HubSpot automatically injects styles, scripts, and meta tags via two mandatory system variables:
These tags ensure that your pages load HubSpot’s core functionality (like tracking scripts, required CSS, and system metadata).
However, what if your page requires dynamic meta tags—for example, Open Graph (OG) data that changes depending on user input or URL parameters? You can’t simply remove standard_header_includes or replace it entirely.
The good news: you can safely override or filter what HubSpot injects into the <head>. This article explains how.
HubSpot templates automatically include two key system variables:
You must include both in your templates — HubSpot will throw an error if you omit them.
While these variables ensure consistency and proper rendering, they can also limit your ability to modify or override certain tags — especially <meta> and <title> elements that HubSpot generates automatically.
Let’s say you’re building a quiz module, a landing page, or a dynamic campaign page where users get unique results or shareable links.
Each result may require its own:
HubSpot will, by default, insert its own generic OG and Twitter tags from the page settings. That leads to duplicate tags or conflicting metadata in your HTML — which can break social previews or confuse crawlers.
So how do you inject your own dynamic OG tags without breaking HubSpot’s system assets?
The key idea:
Let’s walk through a safe, production-ready approach:
Now, you have a “cleaned” head where you can inject your custom meta tags freely.
Once your <head> is under control, you can populate it dynamically — for example, from HubDB, URL parameters, or module fields.
Here’s a simplified real-world example using HubDB:
Now, use these dynamic values for your custom tags:
This structure ensures:
After deployment, test your implementation thoroughly:
Open your page, right-click → View Source Ensure:
Use:
These tools will show exactly how your page previews on each platform.
These tools will show exactly how your page previews on each platform.
HubSpot caches published content aggressively. To refresh:
❌ Omitting standard_header_includes HubSpot will throw an error or your tracking scripts will stop working.
✅ Always keep it in your template — just filter the content.
❌ Over-aggressive regex Removing too much can break analytics or third-party tags.
✅ Use specific patterns — target only the meta tags you need to replace.
❌ Forgetting escape filters Dynamic content from HubDB or modules should always use |escape to avoid invalid HTML or injection issues.
Example:
HubSpot CMS gives developers a powerful templating system with built-in best practices — but sometimes, you need more control than the platform allows by default.
By filtering and re-injecting the standard_header_includes output, you can safely:
This approach keeps your templates flexible, scalable, and ready for any custom scenario — from landing pages to interactive modules.
In short: You can’t disable HubSpot’s system includes — but you can make them work exactly the way you need.