Add a blog to Google Sites™: EmDash on Cloudflare's free plan, step by step
Google Sites has no blog, but a Cloudflare Worker in front of it and an EmDash site next to it give you one on the same domain, on Cloudflare's free plan.
>_ INSIDE_THE_PAGE
Field | Detail |
|---|---|
Problem | Google Sites has no blog or CMS, and you want one on the same domain |
Difficulty | 3 of 5 |
Moving parts | 1 DNS record, 2 Workers (edge + blog), 1 D1 database, 1 R2 bucket |
Reversible | Yes: delete the Workers and the routes, the Site keeps working |
Time and cost | About 1 hour; Cloudflare free plan |
Skills | Terminal basics, Node.js 22.12+, a Cloudflare account |
Last verified | 2026-11-22 on www.eryc.my.id |
Is it possible?
Yes. Google Sites keeps serving your pages; a Cloudflare Worker sits in front of it on your domain, and a separate EmDash site (Astro on Cloudflare Workers, with a D1 database and an R2 bucket for media) becomes the blog. Everything here runs on the free plan. What you give up: EmDash's sandboxed plugins need the paid Workers plan, and Google can change Sites at any time, which can break the parts that touch its HTML.
This is part 0 of the series EmDash for Google Sites. Next: run the blog under /blog on the Sites domain, remove the redirect page, match the Sites look.
What is the big picture?
Every step below is one box or one arrow in these two flows.
One domain, two Workers. Routes decide who answers; bindings give the blog its database and file storage.
The same picture as text, plus the config side.
Request flow, what a visitor hits:
- A visitor reaches Cloudflare DNS (the record for www, proxied = orange cloud).
- Workers Routes decides next: the most specific pattern wins.
www.example.com/*goes to the edge Worker and Google Sites (your pages).www.example.com/blog*goes to the blog Worker (EmDash).- That Worker has the bindings DB (D1: posts, users, settings), MEDIA (R2: images, files) and EMDASH_ROOMS (Durable Object: co-editing).
- SESSION and IMAGES are added by Astro's Cloudflare adapter.
Config flow, where you set each piece:
wrangler.jsoncis the Cloudflare side: the Worker's name, routes and bindings.astro.config.mjsis the EmDash side: which binding is the database and which is media storage.- The code uses them as
env.DBandenv.MEDIA(EmDash does this for you).
The binding name links the two files: DB in wrangler.jsonc must be DB in astro.config.mjs. If they differ, EmDash cannot reach its database or storage.
Which words do I need?
Word | Meaning here |
|---|---|
Zone | Your domain inside Cloudflare ( |
Proxied DNS | The orange cloud: traffic passes through Cloudflare, so Workers can run on it |
Worker | A small program running on Cloudflare, in front of or instead of a server |
Route | A URL pattern that sends matching traffic to a Worker; the more specific pattern wins |
Binding | A named connection that lets a Worker use a resource: |
D1 | Cloudflare's SQL database (SQLite); EmDash keeps content, users and settings in it |
R2 | Cloudflare's file storage; EmDash keeps uploaded media in it, and the bucket stays private |
Durable Object | A small stateful object; EmDash uses one per entry being edited |
KV | Cloudflare's key-value store; Astro keeps sessions in it (binding |
| Cloudflare's command-line tool ( |
The same picture and glossary are in the repo: 00-setup/CONCEPTS.md.
Step 1: Log in to Cloudflare from your terminal
Where it fits: your machine talks to your Cloudflare account; nothing in the picture changes yet.
npx wrangler loginThis opens the browser and stores the login on your machine, so no API token or account ID ever goes into a file you might publish.
Check. npx wrangler whoami prints your account email.
Step 2: Put Google Sites on your domain
Where it fits: the DNS box, proxied.
In Google Sites, open Settings > Custom domains > Start setup, enter www.example.com and follow Google's steps; it asks you to verify the domain and shows the DNS record to add. Add exactly that record in Cloudflare DNS with the proxy on (orange cloud). With the proxy off, Cloudflare never sees the traffic and no Worker can run.

OBSERVED The one DNS record Google Sites needs: www as a CNAME to ghs.googlehosted.com, proxied (orange cloud). Captured 2026-11-22.
Check. curl -sI https://www.example.com/ returns 200 and the page is your Site.
OBSERVED This is how www.eryc.my.id is set up; it was configured before this series, so the steps above follow Google's wizard rather than a timed run.
Step 3: Put a Worker in front of the Site
Where it fits: the edge Worker on the route www.example.com/*.
The repo's sites-worker forwards every request to Google Sites unchanged and only rewrites HTML. It already includes the fix from part 1 that removes Google's "Redirecting you to…" page for links to your own domain. Its route lives in its own wrangler.jsonc:
"routes": [{ "pattern": "www.example.com/*", "zone_name": "example.com" }]The Worker itself:
export default { async fetch(request) { const response = await fetch(request); const type = response.headers.get("content-type") || ""; if (!type.includes("text/html")) return response; const headers = new Headers(response.headers); headers.delete("content-length"); const rewritten = unwrapOwnLinks(new HTMLRewriter()).transform(response); return new Response(rewritten.body, { status: response.status, headers }); },};Test it before it touches your site, then deploy:
cd 00-setup/sites-workernpm install && npm testnpx wrangler deployCheck. MEASURED The local test (2026-11-22, Miniflare, a stand-in Sites page) returned: status 200, the origin's headers kept, own-domain links unwrapped in both href and data-url, the external link left wrapped, images untouched, 0 wrapped own-domain links left.
NOT TESTED This minimal Worker on a live domain. My production Worker does the same pass-through plus more (SEO and structured-data layers), so the live behaviour is observed on www.eryc.my.id, not on these exact lines.
Step 4: Create the EmDash blog
Where it fits: the blog Worker, plus its bindings.
npm create emdash@latest -- my-blogAnswer Cloudflare Workers for where to deploy, then pick the Blog template.
cd my-blognpm run deployOn the first deploy, Wrangler creates the D1 database and the R2 bucket named in wrangler.jsonc. Astro's Cloudflare adapter also adds two bindings of its own: a KV namespace SESSION (Astro sessions) and IMAGES (Cloudflare Images, for image resizing). Do not rename the database or bucket afterwards, or the next deploy creates new, empty ones.
Check. MEASURED On my account the blog Worker was created at 07:31:08 UTC on 2026-11-21, and its D1 database and R2 bucket both appeared at 07:32:36 UTC, from the same first deploy. npx wrangler d1 list and npx wrangler r2 bucket list should show yours.
My blog deploys from GitHub (Workers Builds: a push to main builds and deploys in about two minutes) instead of npm run deploy. Both reach the same result; Git is easier once you publish often.
Step 4b: How are D1 and R2 bound to EmDash?
Where it fits: the binding arrows from the blog Worker.
Two files must agree. wrangler.jsonc gives Cloudflare the resources and their names:
"d1_databases": [{ "binding": "DB", "database_name": "my-blog" }],"r2_buckets": [{ "binding": "MEDIA", "bucket_name": "my-blog-media" }],"durable_objects": { "bindings": [{ "name": "EMDASH_ROOMS", "class_name": "EmDashRoom" }] }astro.config.mjs tells EmDash which name is which:
emdash({ database: d1({ binding: "DB" }), storage: r2({ binding: "MEDIA" }),})OBSERVED These are the exact binding names in my blog's files. The template writes both for you; you only edit them if you rename something, and then you edit both.
If you prefer fixed names, or want to reuse a database, create them yourself first (EmDash's Cloudflare guide shows the same two commands):
npx wrangler d1 create my-blognpx wrangler r2 bucket create my-blog-mediaThe R2 bucket stays private. EmDash serves media through its own Worker at /_emdash/api/media/file/..., so you never make the bucket public.
Check. Cloudflare dashboard > Workers & Pages > your blog > Settings > Bindings lists DB (D1), MEDIA (R2) and EMDASH_ROOMS (Durable Object), plus SESSION (KV) and IMAGES, which the Astro adapter adds without a line in wrangler.jsonc (the adapter's defaults, checked in @astrojs/cloudflare 14.4.9).

OBSERVED My blog Worker's Bindings tab: five bindings, five names the code uses. Captured 2026-11-22; account name blurred.
What the free plan covers (Cloudflare docs, checked 2026-11-22): D1 allows 10 databases, 500 MB per database and 5 GB per account, with daily row read and write limits; since 1 September 2026, queries fail for the rest of the day once those daily limits are passed. R2 includes 10 GB of storage per month. A small blog stays far below all of these.
Backups. D1 keeps 7 days of point-in-time recovery on the free plan. For your own copy:
npx wrangler d1 export my-blog --remote --output=./backup.sqlMore detail in the repo: 00-setup/STORAGE.md.
Step 5: Finish the admin wizard
Where it fits: the first write into D1 (your admin account).
Open the workers.dev address Wrangler printed, add /_emdash/admin/, and create the admin account.
Check. You can sign in and see the empty Posts list.
What went wrong?
- Sign-in is tied to one host. The admin login belongs to the hostname you used for it. When I later moved the public blog to
www.eryc.my.id/blog, I kept/_emdashand/_astroon the blog's own host so the admin sign-in keeps working there. Part 2 shows the exact rule. - Two addresses for one blog. The blog answered on its own host and on
/blog. I now send readers from the blog host to/blogwith a 301, so search engines see one address. - I listed the wrong bindings at first. An earlier draft of this post said my blog had no KV namespace. The dashboard capture above shows
SESSION(KV) andIMAGES, added by the Astro adapter. Check the Bindings tab rather than trusting the config file alone.
Limits
- Google can change Sites markup and CSS at any time.
- NOT TESTED A full run of the repo's exact files on a brand-new domain.
- Sandboxed EmDash plugins need the paid Workers plan; this setup does not use them.
- EmDash is young software; commands may change. The commands above were checked against the EmDash and Cloudflare docs on 2026-11-22.
Files and reproduction
Repo: ErycTheGreat/emdash-for-google-sites (MIT). This post is folder 00-setup: start with CONCEPTS.md, then README.md, and run CHECK.md after each step. With an AI agent: "Use the emdash-for-google-sites skill to set this up for my domain"; the skill explains each piece before doing it, checks the binding names, and stops before it touches DNS or a live route.
Next in the series: part 2, the blog under /blog, then part 1, the redirect fix, then part 3, matching the look.
How this was made
Built and tested by Eryc Tri Juni S on his own site. Timestamps come from his Cloudflare account; the Worker test was run locally on the date shown; screen captures were taken from his Cloudflare dashboard on 2026-11-22 with the account name blurred; limits and commands come from the Cloudflare and EmDash docs on that date. Drafted with AI assistance (Claude); every sentence was reviewed and every fact checked by the author.
About the author
Eryc Tri Juni S is an Edge SEO & GEO (Generative Engine Optimization) Specialist in Malang, Indonesia, an Electrical Engineer with 8 years in electronic product innovation, now at the intersection of Edge SEO, GEO, and AI retrieval infrastructure. About · GitHub
Changelog
- 2026-11-22: first version.
Google Sites is a trademark of Google LLC. This project is not affiliated with or endorsed by Google.
Related prompts
- 01
How can I add a blog to a Google Sites website?
- 02
Can I run a CMS on the same domain as Google Sites?
- 03
How do I set up EmDash with Cloudflare D1 and R2?
Related concepts
- Content Management System (CMS)
- Blogging
- HTTPS
- Cloudflare Workers
- Edge computing