WebToSpeech

For publishers · Add an audio player to a Hugo blog

Put an audio player on every Hugo post.

Add two lines to your Hugo single post layout and every article gets a fast, cookie-free audio player—with zero npm dependencies and no impact on build time.

Works with PaperMod, Congo, Blowfish, Ananke, and custom Hugo themes. Requires the Publisher plan.

  1. Step 1

    Add your domain in WebtoSpeech

    Open Settings → Sites, add your site’s domain, and copy your verification token and ws_ site key.

  2. Step 2

    Verify via head partial or DNS

    Add the meta tag to your site’s head partial (for example layouts/partials/extend_head.html in PaperMod) or add the DNS TXT record, build and deploy, then click Verify.

    layouts/partials/extend_head.html

    <meta name="webtospeech-verification" content="your_verification_code">
  3. Step 3

    Place the snippet in your single post template

    Override your theme’s single template in your project’s own layouts/_default/single.html and add the player just above {{ .Content }}.

    layouts/_default/single.html

    {{ if eq .Section "posts" }}
      <div data-webtospeech></div>
      <script src="https://webtospeech.app/embed.js" data-site="ws_your_site_key" async></script>
    {{ end }}
  4. Step 4

    Build, deploy, and listen

    Hugo compiles static HTML as fast as ever. The first time a visitor clicks play on a post, WebtoSpeech reads it and caches the finished audio for everyone else.

    Enable enableGitInfo = true in hugo.toml and render .Lastmod in article:modified_time so updated posts are re-read automatically.

Opt out on specific posts with front matter

Wrap the snippet in {{ if not .Params.noAudio }} so you can skip short link posts or announcements by setting noAudio = true in front matter.

layouts/_default/single.html

{{ if and (eq .Section "posts") (not .Params.noAudio) }}
  <div data-webtospeech></div>
  <script src="https://webtospeech.app/embed.js" data-site="ws_your_site_key" async></script>
{{ end }}

Good to know on Hugo

Override in layouts/, not themes/

Copy single.html from your theme into your root layouts/ directory before editing so updating the theme submodule never wipes out the player.

Connect Hugo’s built-in index.xml for a podcast

Hugo generates /index.xml or /posts/index.xml automatically. Connect it in Settings → Sites → Feed and podcast to turn every new post into a podcast episode.

No cookies, even on strict static blogs

Many Hugo bloggers avoid trackers and cookie banners altogether. WebtoSpeech sets zero cookies and makes no third-party tracking calls.

Zero build-time API calls

Because audio is generated lazily when a visitor presses play (or via your RSS feed), hugo --minify stays completely offline and millisecond-fast.

See everything else the player does

Questions

Does WebtoSpeech require a Hugo plugin or build hook?
No. It is plain HTML in your single post template, so your Hugo build remains static, fast, and dependency-free.
Can I use Hugo’s default RSS feed to generate a podcast?
Yes. Point WebtoSpeech at /index.xml or /posts/index.xml and enable automatic reading to publish an Apple Podcasts and Spotify RSS feed.
How do I match my Hugo theme’s dark mode?
The player automatically follows the visitor’s system preference, or you can set data-theme="light" or data-theme="dark" on the player div.

Publisher plan

$29 a month. Unlimited sites.

200 hours of audio a month, every Studio and standard voice, cookie-free embeds, RSS-to-podcast feeds, and play counts.