How to Set Up a Voice-Enabled Blog with AI Narration
Why a Voice‑Enabled Blog? Reading a long‑form post on a screen can be tiring, especially on mobile. Adding an AI‑generated narration turns a static article into an accessible, multitasking‑friendly experience. With mod
Why a Voice‑Enabled Blog?
Reading a long‑form post on a screen can be tiring, especially on mobile. Adding an AI‑generated narration turns a static article into an accessible, multitasking‑friendly experience. With modern text‑to‑speech (TTS) engines you can get natural‑sounding voices in seconds, and with voice cloning you can even give your blog a unique “audio brand.”
In this post I’ll walk you through building a voice‑enabled blog from scratch, wiring up ElevenLabs for the narration, and deploying everything on Bluehost – the easy, affordable way to get your site live.
What You’ll Need
| Item | Reason |
|---|---|
| A static site generator (e.g., Hugo, Jekyll, or plain HTML) | Generates the blog pages you’ll serve |
| A free ElevenLabs account (sign‑up here: https://try.elevenlabs.io/kr07zfuqn1bp) | Provides high‑quality TTS and voice cloning |
| A Bluehost hosting plan (grab it here: https://bluehost.sjv.io/5k0d52) | One‑click WordPress/Hugo deployment and cheap SSL |
| Basic Python or JavaScript knowledge | To call the ElevenLabs API and embed the audio player |
| Git (optional but handy) | For version control and easy deployment |
All of these tools are either free or have generous trial tiers, so you can experiment without spending a dime.
1. Spin Up a Simple Blog
I’ll use Hugo because it’s fast, has a tiny footprint, and works nicely with static hosting.
# Install Hugo (Mac / Linux)
brew install hugo
# Create a new site
hugo new site my-voice-blog
cd my-voice-blog
# Add a theme (feel free to pick any you like)
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
echo 'theme = "ananke"' >> config.toml
# Create a sample post
hugo new posts/hello-world.md
Edit content/posts/hello-world.md and add some Markdown content. When you’re ready, preview locally:
hugo server -D
You should see your blog at http://localhost:1313. At this point you have a perfectly functional static site—now let’s give it a voice.
2. Generate Audio with ElevenLabs
ElevenLabs offers a simple REST API. The workflow is:
-
Send the article text to the
/v1/text-to-speech/{voice_id}endpoint. - Receive an MP3 URL (or raw binary) in the response.
- Store the MP3 alongside the post or stream it directly.
a. Get Your API Key
- Sign up at https://try.elevenlabs.io/kr07zfuqn1bp.
- Navigate to Dashboard → API Keys and copy the key.
b. Python Helper Script
Save this as tts_generate.py in the root of your Hugo site:
import os
import requests
import json
from pathlib import Path
# ---- Config ----
ELEVENLABS_API_KEY = os.getenv("ELEVENLABS_API_KEY")
VOICE_ID = "EXAVITQu4vr4xnSDxMaL" # default "Rachel" voice; replace with your cloned voice ID
OUTPUT_DIR = Path("static/audio") # Hugo will serve files from /static
# Ensure output folder exists
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
def generate_audio(post_path: Path):
# Load the markdown file and extract the content (skip front‑matter)
with post_path.open() as f:
lines = f.readlines()
content = "".join(line for line in lines if not line.startswith("---"))
# Call ElevenLabs TTS API
url = f"https://api.elevenlabs.io/v1/text-to-speech/{VOICE_ID}"
headers = {
"xi-api-key": ELEVENLABS_API_KEY,
"Content-Type": "application/json"
}
payload = {
"text": content,
"model_id": "eleven_monolingual_v1",
"voice_settings": {"stability": 0.75, "similarity_boost": 0.85}
}
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
audio_data = response.content
# Save the MP3 next to the post slug
slug = post_path.stem
audio_path = OUTPUT_DIR / f"{slug}.mp3"
audio_path.write_bytes(audio_data)
print(f"✅ Audio saved to {audio_path}")
if __name__ == "__main__":
# Example: generate audio for every markdown post
for md_file in Path("content/posts").glob("*.md"):
generate_audio(md_file)
Run it after you write a post:
export ELEVENLABS_API_KEY=your_key_here
python tts_generate.py
Each post now has a corresponding MP3 in static/audio/. Hugo will automatically copy those files to the public folder when you build the site.
c. Quick curl Alternative
If you prefer a one‑liner for testing:
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL" \
-H "xi-api-key: $ELEVENLABS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello, this is a test of ElevenLabs TTS!","model_id":"eleven_monolingual_v1"}' \
--output hello.mp3
You’ll see hello.mp3 in your cwd—perfect for quick sanity checks.
3. Embed the Audio Player
Now that the MP3s are part of your static assets, add a small HTML snippet to each post template. Edit themes/ananke/layouts/_default/single.html (or the appropriate layout for your theme) and insert:
{{ if .File.BaseFileName }}
<audio controls style="width:100%; margin-top:1rem;">
<source src="/audio/{{ .File.BaseFileName }}.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
{{ end }}
When Hugo renders a post, it will look for static/audio/<slug>.mp3. If the file exists, the player appears right below the article title.
4. Deploy to Bluehost
Why Bluehost?
- One‑click WordPress/Hugo installs – no fiddling with Apache configs.
- Free SSL (HTTPS) – essential for API calls to ElevenLabs.
- Affordable plans – starts at just a few dollars a month, perfect for hobby projects.
a. Create a New Site
- Click the affiliate link: https://bluehost.sjv.io/5k0d52 and sign up for the “Basic” plan (or higher if you need more storage).
- In the Bluehost dashboard, hit “Site Builder → WordPress” (or “Custom PHP” if you want to host Hugo directly).
- Choose a domain (you can use a free subdomain for testing).
b. Push Your Hugo Site
The simplest route is to generate the static files locally and upload them via FTP or the File Manager.
# Build the site
hugo -D
# The public folder now contains all HTML, CSS, JS, and your audio files.
- Open the Bluehost File Manager →
public_html. - Delete any placeholder
index.html. - Upload the entire contents of the
publicfolder (not the folder itself).
Your site should be live at https://yourdomain.com within a minute.
c. Optional: Automatic Deploy with Git
If you prefer continuous deployment:
- In the Bluehost dashboard, enable Git™ for your domain.
- Add a remote repo (GitHub, GitLab, or Bitbucket).
- Push to
master/mainand let Bluehost runhugoon the server (you may need to add a simple build script).
Now every time you add a new post and run python tts_generate.py, just push the changes and the audio will be served automatically.
5. Fine‑Tuning the Voice (Optional)
ElevenLabs lets you clone your own voice (with a few minutes of recorded audio). Once you have a custom voice ID, replace the VOICE_ID constant in tts_generate.py. You’ll instantly give your blog a signature narration style—great for personal branding.
6. Wrap‑Up Checklist
- [x] Static site generated (Hugo/Jekyll)
- [x] ElevenLabs API key stored securely (
ELEVENLABS_API_KEYenv var) - [x] Python script creates an MP3 per post in
static/audio/ - [x] Audio player embedded in the post template
- [x] Site built and uploaded to Bluehost (
https://bluehost.sjv.io/5k0d52) - [x] SSL enabled, API calls work over HTTPS
That’s it! You now have a fully functional voice‑enabled blog that’s accessible, SEO‑friendly, and ready to scale.
What’s Next?
- Add a “listen‑later” playlist using localStorage and a small JS widget.
- Integrate a language selector and feed the text through ElevenLabs’ multilingual models.
- Track audio plays with Google Analytics events to see how many visitors prefer listening.
If you enjoyed this walkthrough, give it a 👍, share it with fellow devs, and start experimenting with different voices.
Ready to give your blog a voice? Sign up for ElevenLabs here: https://try.elevenlabs.io/kr07zfuqn1bp and spin up your hosting on Bluehost with this link: https://bluehost.sjv.io/5k0d52. Happy coding!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.