BUZER
Skip to main content
Integration time5 minutes

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

1

Sign up for Buzer

Create your publisher account at buzer.xyz. Authenticate with Face ID or Touch ID for instant onboarding.

2

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.

html
<!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>
3

Create a Buzer ad partial

Create a reusable Hugo partial template for ad placements. Save it as layouts/partials/buzer-ad.html.

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>
4

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.

html
{{/* 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?+
Yes. You can add the Buzer script and ad partials to any Hugo theme. If the theme uses a baseof.html template, add the script there. If not, add it to the theme's header or footer partial. Most themes support custom partials for exactly this purpose.
Can I conditionally show ads on certain Hugo pages?+
Yes. Use Hugo's template logic to conditionally include the ad partial. For example, you can show ads only on blog posts using {{ if eq .Section "posts" }}{{ partial "buzer-ad.html" . }}{{ end }}, or exclude specific pages using front matter flags.
How do I add Buzer ads to Hugo multilingual sites?+
The Buzer script and ad containers work the same across all languages. Add the script to your base template and use the ad partial in your content templates. Buzer automatically serves ads relevant to the visitor's locale and language.

Related Resources

Start earning 85% revenue share

Join Buzer and keep more of what you earn. No minimum traffic requirements. Instant payments in USDC.