The Hidden HubSpot Developer Toolkit
HubSpot’s developer documentation covers the basics, but there are powerful query parameters, CSS classes, and diagnostic endpoints that many developers never discover. These obscure features are often buried in documentation or discovered through trial and error, but they can save hours of debugging time and unlock functionality that isn’t widely known.
Here are 9 verified techniques that experienced HubSpot developers use but are rarely discussed in tutorials or guides.
1. Force Cache Refresh with ?hsCacheBuster
The Problem: HubSpot’s aggressive caching makes testing changes frustrating – updates don’t appear immediately.
The Solution:
https://yoursite.com/?hsCacheBuster=12345
How it works:
- Add
?hsCacheBuster=
followed by any number to your URL - Change the number each time you want to bypass cache
- Forces HubSpot to serve fresh content instead of cached version
Real-world usage:
Testing homepage changes:
https://yoursite.com/?hsCacheBuster=001
https://yoursite.com/?hsCacheBuster=002
https://yoursite.com/?hsCacheBuster=003
When to use: During development, testing template changes, or troubleshooting caching issues.
2. Debug Page Performance with
?hsDebugOnly=true
The Problem: Page loading slowly but can’t identify bottlenecks in HubSpot’s rendering process.
The Solution:
https://yoursite.com/?hsDebugOnly=true
What you get:
- Page load timing breakdown
- Template rendering performance
- Module execution times
- Database query performance
- Potential bottlenecks and errors
Best practices:
- Use in combination with browser dev tools
- Check both desktop and mobile performance
- Compare different pages to identify patterns
3. Client Diagnostics with
/_hcms/diagnostics
The Problem: Need to troubleshoot visitor-specific issues like cookies, headers, or browser detection.
The Solution:
https://yoursite.com/_hcms/diagnostics
Information provided:
- Visitor’s IP address and geolocation
- Browser user agent and capabilities
- Cookie values and session data
- HTTP headers sent by the browser
- HubSpot tracking pixel status
Use cases:
- Debugging personalization issues
- Troubleshooting smart content display
- Investigating tracking problems
- Verifying geo-targeting setup
4. Server Header Analysis with /_hcms/_worker/headers
The Problem: Need to see exactly what HTTP headers HubSpot is sending with responses.
The Solution:
https://yoursite.com/_hcms/_worker/headers
Headers you’ll see:
- Cache control directives
- Security headers (CSP, HSTS, etc.)
- Content type and encoding
- Server response codes
- Custom headers configured in HubSpot
Professional use:
- SEO header optimization
- Security header verification
- CDN configuration troubleshooting
- Performance header analysis
5. Hide Content from Search with hs-search-hidden
The Problem: HubSpot’s site search returns irrelevant results from headers, footers, or navigation elements.
The Solution:
html
<div class="hs-search-hidden">
<p>This content won't appear in search results</p>
</div>
Strategic applications:
html
<!-- Hide repetitive navigation from search -->
<nav class="hs-search-hidden">
<ul>...</ul>
</nav>
<!-- Hide footer content from search -->
<footer class="hs-search-hidden">
<div>Copyright information...</div>
</footer>
<!-- Hide sidebar widgets from search -->
<aside class="hs-search-hidden">
<div>Related links...</div>
</aside>
SEO benefit: Improves search result quality by focusing on actual content rather than navigation elements.
6. Prevent Page Caching with Dynamic Content
The Problem: Need certain pages to never be cached (forms with dynamic content, user-specific pages).
The Solution:
hubl
<span class="visually-hidden hs-search-hidden">{{ request.remote_ip }}</span>
How it works:
request.remote_ip
is different for every visitor- HubSpot can’t cache pages with visitor-specific content
visually-hidden
keeps it invisible to usershs-search-hidden
excludes it from search indexing
Performance warning: Use sparingly – disables caching benefits and can slow page loads.
Valid use cases:
- Real-time dashboards
- User-specific content pages
- Testing environments
- Dynamic form pages with visitor-specific data
7. Debug HubL Variables with |pprint
The Problem: Need to see exactly what data is available in HubL variables during development.
The Solution:
hubl
{{ loop.index|pprint }}
{{ content|pprint }}
{{ request|pprint }}
{{ blog_post|pprint }}
Output example:
loop.index: 3
content: {
'id': 12345,
'name': 'Homepage',
'slug': 'home'
}
Development workflow:
hubl
<!-- Debug during development -->
{{ variable_name|pprint }}
<!-- Remove before production -->
<!-- {{ variable_name|pprint }} -->
Advanced debugging:
hubl
<!-- Check what's available in current context -->
{{ this|pprint }}
<!-- Debug specific object properties -->
{{ blog_post.topic_list|pprint }}
8. Access HubDB Column Options
The Problem: Need to programmatically access dropdown options or choice values from HubDB columns.
The Solution:
hubl
{{ hubdb_table_column(table_id, "column_name").options }}
Real example:
hubl
<!-- Get options for a "category" dropdown column -->
{% set category_options = hubdb_table_column(2664466, "category").options %}
<!-- Loop through available options -->
{% for option in category_options %}
<option value="{{ option.value }}">{{ option.label }}</option>
{% endfor %}
Use cases:
- Building dynamic forms based on HubDB data
- Creating filter interfaces
- Validating user input against available options
- Maintaining consistency between HubDB and templates
9. Highlight Search Results with CSS
The Problem: Want to visually highlight matching search terms in search results.
The Solution:
html
<span class="hs-search-highlight hs-highlight-html">matching text</span>
CSS styling:
css
.hs-search-highlight {
background-color: yellow;
font-weight: bold;
}
.hs-highlight-html {
padding: 2px 4px;
border-radius: 3px;
}
How it works:
- HubSpot automatically wraps matching search terms
hs-search-highlight
class applied to matcheshs-highlight-html
provides additional styling hook- Appears in search results pages automatically
Documentation: This is actually documented in HubSpot’s search module docs but many developers don’t know about it.
10. Bonus! Environment-Specific Content with Domain Detection
The Problem: Need to show development messages, admin tools, or special content only on staging/preview domains, not on the live site.
The Solution:
hubl
{%- if request.domain == 'preview.hs-sites.com' or
request.domain == 'app.hubspot.com' or
request.domain == 'www-yoursite-com.sandbox.hs-sites.com' or
(request.domain == '12345.hubspotpreview-na1.com') -%}
{# replace 12345 with your hubspot account id #}
<div class="dev-notice" style="background: red; color: white; padding: 10px;">
<strong>DEVELOPMENT MODE</strong> - This is a preview environment
</div>
<nav class="admin-tools">
<a href="?hsCacheBuster=123">Clear Cache</a>
<a href="?hsDebugOnly=true">Debug Mode</a>
</nav>
{%- else -%}
<!-- Production content or nothing -->
{%- endif -%}
Common HubSpot domains to check for:
preview.hs-sites.com
– Standard preview domainapp.hubspot.com
– HubSpot app environment*.sandbox.hs-sites.com
– Sandbox environments*.hubspotpreview-na1.com
– Regional preview domains
Professional use cases:
hubl
{%- set is_development = request.domain == 'preview.hs-sites.com' or
request.domain contains 'sandbox' or
request.domain contains 'hubspotpreview' -%}
{% if is_development %}
<!-- Debug information panel -->
<div class="debug-panel">
<h3>Development Info</h3>
<p>Domain: {{ request.domain }}</p>
<p>Template: {{ content.template_path }}</p>
<p>Page ID: {{ content.id }}</p>
</div>
<!-- Developer-only navigation -->
<div class="dev-tools">
<a href="/_hcms/diagnostics">Diagnostics</a>
<a href="?hsDebugOnly=true">Performance Debug</a>
</div>
{% endif %}
Advanced environment detection:
hubl
{%- set environment = 'production' -%}
{%- if request.domain contains 'preview' or
request.domain contains 'sandbox' or
request.domain == 'app.hubspot.com' -%}
{%- set environment = 'development' -%}
{%- endif -%}
<body class="env-{{ environment }}">
{% if environment == 'development' %}
<!-- Development-specific content -->
{% endif %}
Combining Techniques for Advanced Debugging
Development Workflow
html
<!-- Complete debugging setup -->
<div class="debug-info" style="background: #f0f0f0; padding: 20px; margin: 20px 0;">
<h3>Debug Information</h3>
<!-- Show current request info -->
<strong>Request:</strong>
{{ request|pprint }}
<!-- Show page content data -->
<strong>Content:</strong>
{{ content|pprint }}
<!-- Cache buster for testing -->
<p>Current URL with cache buster:
<a href="?hsCacheBuster={{ "now"|strftime('%s') }}">Refresh Cache</a>
</p>
</div>
<!-- Hide debug info from search and make it uncacheable -->
<span class="visually-hidden hs-search-hidden">{{ request.remote_ip }}</span>
Production Cleanup
hbs
{% comment %}
Remove all debug code before going live:
- Remove |pprint filters
- Remove debug div elements
- Remove cache busting links
- Keep hs-search-hidden classes where appropriate
{% endcomment %}
Best Practices and Warnings
Performance Considerations
Cache busting:
- Only use during development
- Remove before production launch
- Can significantly slow page loads if overused
Uncached pages:
- Use
request.remote_ip
technique sparingly - Monitor page performance impact
- Consider if dynamic content is truly necessary
Security Considerations
Diagnostic endpoints:
- Don’t expose sensitive information in production
- Consider restricting access in security-sensitive environments
- Be aware of what client information you’re revealing
Debug information:
- Remove all
|pprint
filters from production templates - Hide or remove debug output before launch
- Don’t expose internal data structures publicly
Professional HubSpot Development Services
These techniques represent advanced HubSpot development knowledge that comes from years of hands-on experience. Complex HubSpot implementations often require this level of detailed platform knowledge:
Advanced scenarios requiring expert knowledge:
- Custom module development with complex debugging needs
- Performance optimization for high-traffic HubSpot sites
- Complex HubDB integrations requiring programmatic access
- Advanced search implementations with custom highlighting
When to get professional help:
- Custom theme development requiring advanced HubL techniques
- Performance issues that require deep platform knowledge
- Complex integrations between HubSpot and external systems
- Team training on advanced HubSpot development practices
Need help with advanced HubSpot development projects? Contact Knihter for professional HubSpot development services. We specialize in custom HubSpot solutions and advanced HubL implementations.
Related Services:
- Custom HubSpot theme and module development
- HubSpot performance optimization and debugging
- Advanced HubDB and CRM integrations
- HubSpot developer training and consulting