🔍 E-commerce / Media / SaaS

SEO Boost — Dynamic Titles, Meta & Structured Data

A Cloudflare Worker intercepts every product or film page and injects SEO-critical tags via HTMLRewriter before Googlebot or a browser sees the response. Your backend never changes.

The Problem

""Our React SPA sends the same generic title to every URL. Googlebot sees blank meta descriptions. Our product pages don’t show up in Google Search — and even when they do, there are no stars, no price, nothing that makes someone click.""

The Outcome

Rich Results

eligible in Google Search — stars, price, and availability injected via JSON-LD structured data. Unique title + meta description per URL. Zero origin code changes.

Live demo below
Select product:
Without WorkerSPA shell · origin unchanged
Origin HTML <head> — what every product URL sends
<title>HÖMSTYLE — Furniture & Home</title>
<!-- no <meta name="description"> — SPA sets via JS after hydration -->
<!-- no JSON-LD structured data -->
<!-- no og:title / og:image -->
<!-- identical for EVERY product URL -->

What Google sees without the Worker

G
yourdomain.com › products › ek03

HÖMSTYLE — Furniture & Home

Home · Sofas · Beds · Wardrobes · Desks · Lighting · Sale · Sign In — Free delivery on orders over $50. HÖMSTYLE © 2026.

With Cloudflare WorkerHTMLRewriter · ~10ms overhead

🔍

Run the demo to see what Googlebot gets after the Worker runs

~10ms

HTMLRewriter overhead

streaming — no buffering

0

origin code changes

Worker is additive

100%

pages Rich Result ready

stars + price in Google

How it works

1

Route matches

Worker intercepts /products/* or /films/* HTML requests

2

KV lookup

Checks KV cache for item metadata — avoids D1 on every crawl

3

HTMLRewriter

Streams origin HTML, rewrites <title>, injects <meta>, appends JSON-LD

4

Rich Results

Google sees structured data → eligible for stars, price, availability

Productionising this

What changes when you ship this for real

Bot-aware rewriting

Detect Googlebot via request.headers.get('user-agent') and serve the enriched JSON-LD only to bots — keeps human page weight low. Google explicitly allows this when content matches.

Canonical URLs

HTMLRewriter must inject a single canonical <link rel='canonical'> per URL. Duplicate canonicals tank rankings. Strip the origin's default first.

Structured data validation

Run injected JSON-LD through Google's Rich Results Test in CI. Add a Worker route /_seo-check that returns the rewritten HTML so Lighthouse / Schema.org validators can hit it.

Cache rewrites by URL

Catalog data is stable. KV-cache the rewritten (title, meta, jsonld) tuple per URL with 1h TTL. Invalidate on product update via Cloudflare Cache API purge.

Sitemap generation

Add a /sitemap.xml Worker route that pulls from D1 — Googlebot finds new products immediately, no engineering ticket.

Observability

Tag responses with X-SEO-Rewritten: 1. Watch the rate via Workers Logs. If it drops, you have an HTMLRewriter regression.