Always include is:inline on the script tag
Astro tries to bundle <script> tags that have no attributes. Adding is:inline preserves data-site and async cleanly in the rendered HTML.
For publishers · Add an audio player to an Astro blog
Add two lines to your Astro post layout and every Markdown or MDX article gets a cookie-free audio player—with zero React, Vue, or client hydration required.
Works with Astro Content Collections, Starlight docs, static builds, and SSR deployments. Requires the Publisher plan.
Step 1
Add your production domain in Settings → Sites to get your verification meta tag and ws_ site key.
Step 2
Paste the verification meta tag into your BaseHead.astro (or layout <head>), deploy, and click Verify in WebtoSpeech. You can also verify via a DNS TXT record instead.
src/components/BaseHead.astro
<meta name="webtospeech-verification" content="your_verification_code">
Step 3
Place the player element right above <slot /> in your BlogPost.astro layout, and include is:inline on the script tag so Astro outputs the external script verbatim without bundling it.
src/layouts/BlogPost.astro
<div data-webtospeech></div>
<script is:inline src="https://webtospeech.app/embed.js" data-site="ws_your_site_key" async></script>
Step 4
Once deployed to your verified domain, open any post and press play. Audio streams within seconds on the first play and is cached for every reader afterwards.
If your Astro site outputs <link rel="canonical"> and <meta property="article:modified_time">, WebtoSpeech uses them automatically to keep edited posts in sync.
Pass data-theme="light" or data-theme="dark" if your Astro theme uses a manual toggle instead of prefers-color-scheme, or wrap the snippet in a front-matter flag like {!frontmatter.hideAudio && ...}.
src/layouts/BlogPost.astro
{!frontmatter.hideAudio && (
<div data-webtospeech data-theme="dark"></div>
)}
Astro tries to bundle <script> tags that have no attributes. Adding is:inline preserves data-site and async cleanly in the rendered HTML.
Set site in astro.config.mjs and render <link rel="canonical"> in your head so /posts/hello and /posts/hello/ share one generated audio file.
If you use client-side View Transitions, keep the script tag inside your post layout or re-run mount logic on astro:page-load, or disable transitions on long-form blog posts.
Already generating /rss.xml with @astrojs/rss? Connect it in Settings → Sites → Feed and podcast to publish every new Astro post to Apple Podcasts and Spotify.
Platform guide
Two lines in your Hugo single.html template, with Lastmod sync and automatic RSS-to-podcast from index.xml.
Platform guide
Use next/script and metadata.other in Next.js App Router to add a cookie-free audio player to every MDX or CMS post.
Podcast workflow
Connect any verified blog’s RSS or Atom feed to auto-generate episodes for Apple Podcasts, Spotify, and Overcast.
Publisher plan
200 hours of audio a month, every Studio and standard voice, cookie-free embeds, RSS-to-podcast feeds, and play counts.