How to Add Ads to Hugo with Buzer (2026 Guide)
Hugo is the fastest static site generator, building thousands of pages in seconds. Its template-based architecture makes it straightforward to add Buzer ads using Hugo partials. Whether you run a personal blog or a large documentation site, you can start earning in under 5 minutes.
Step-by-Step Integration
Sign up for Buzer
Create your publisher account at buzer.xyz. Authenticate with Face ID or Touch ID for instant onboarding.
Add the Buzer script to your base template
Edit your base template (typically layouts/_default/baseof.html) and add the Buzer script before the closing body tag.
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head.html" . }}
</head>
<body>
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
<script async src="https://cdn.buzer.xyz/x402-ad.js"></script>
</body>
</html>Create a Buzer ad partial
Create a reusable Hugo partial template for ad placements. Save it as layouts/partials/buzer-ad.html.
{{/* layouts/partials/buzer-ad.html */}}
{{ $size := .size | default "300x250" }}
<div class="buzer-ad-container" style="display:flex;justify-content:center;margin:1rem 0;">
<div data-buzer-ad data-size="{{ $size }}"></div>
</div>Use the partial in your content templates
Include the ad partial in your single page template, list template, or any other Hugo template where you want ads to appear.
{{/* layouts/_default/single.html */}}
{{ define "main" }}
<article>
<h1>{{ .Title }}</h1>
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{ partial "buzer-ad.html" (dict "size" "728x90") }}
<div class="content">
{{ .Content }}
</div>
{{ partial "buzer-ad.html" (dict "size" "300x250") }}
</article>
{{ end }}Why Hugo Publishers Love Buzer
Hugo sites are known for their speed — sub-second builds and lightning-fast page loads. Buzer complements this by providing an ad script that is equally lightweight. At under 5KB gzipped, the Buzer script loads in milliseconds and does not impact your Hugo site's Core Web Vitals.
Hugo's partial template system makes ad placement elegant and maintainable. Define your ad partial once, then include it across all your templates with a single line. Change the size or configuration in one place and it updates everywhere.
With Buzer's 85% revenue share and daily USDC payments, you keep far more of what your content earns compared to traditional ad networks that take 30-50% of revenue.
Hugo Shortcodes for In-Content Ads
For ads placed within Markdown content (not just templates), you can create a Hugo shortcode. Save it as layouts/shortcodes/buzer-ad.html with the same ad container markup. Then use {{< buzer-ad size="300x250" >}} directly in your Markdown files.
This is particularly useful for long-form articles where you want to place an ad after a specific section, not just at the top or bottom of the page. Shortcodes give content authors control over ad placement without touching template files.
Combine template-based ads (header leaderboard, footer banner) with shortcode-based in-content ads for maximum monetization without cluttering the reading experience.
Frequently Asked Questions
Does Buzer work with Hugo themes from the theme gallery?+
Can I conditionally show ads on certain Hugo pages?+
How do I add Buzer ads to Hugo multilingual sites?+
Related Resources
Add Ads to Gatsby
Monetize your Gatsby site with Buzer ads. 85% revenue share, instant USDC payments. Works perfectly with Gatsby's static generation and hydration.
Add Ads to Astro
Monetize your Astro site with Buzer ads. 85% revenue share, daily USDC payments. Works with Astro islands architecture and any UI framework.
Add Ads to HTML
Add Buzer ads to any static HTML website. Earn 85% revenue share with instant USDC payments. Just two lines of code for any HTML page.
Start earning 85% revenue share
Join Buzer and keep more of what you earn. No minimum traffic requirements. Instant payments in USDC.