docs: stage the docs on Cloudflare at impulso-next.quantclimate.com - #373
Merged
Merged
Conversation
Serve the Sphinx build from a Cloudflare Worker with static assets, the same way as the quantclimate.com landing page, so that Cloudflare Web Analytics covers the docs with no code in the repo. GitHub Pages keeps serving impulso.quantclimate.com until the staging hostname checks out. html_handling "none" serves each file at the URL Sphinx gives it; _redirects maps / and /dir/ to their index.html. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
thomaspinder
enabled auto-merge
September 30, 2026 20:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The docs are served by GitHub Pages, outside the Cloudflare zone that serves the rest of quantclimate.com. Because of that, Cloudflare Web Analytics cannot see the docs (see #367 and #372). The landing page is a Cloudflare Worker that serves static assets, and Cloudflare adds the analytics beacon to it at the edge with no code in the repo. This PR serves the docs the same way.
This is the staging step. The docs deploy to
impulso-next.quantclimate.com, and GitHub Pages keeps servingimpulso.quantclimate.comunchanged. A follow-up PR moves the real hostname once staging checks out.Solution
docs/wrangler.jsonc: a Worker namedimpulso-docsthat serves the Sphinx build as static assets, on the custom domainimpulso-next.quantclimate.com. No Worker code, no workers.dev URL.html_handling: "none"serves each file at exactly the URL Sphinx gives it, so/page.htmlstays/page.html. Cloudflare's default mode would redirect every.htmlURL to an extensionless one, away from the canonical links and the sitemap.docs/_redirects(copied to the site root byhtml_extra_path) serves/and/dir/from theirindex.html.deploy-docs-cloudflare: on pushes tomain, it takes the same build artifact that the GitHub Pages job deploys and runswrangler deploy(Wrangler 4.145.0, Node 24). It reads theCLOUDFLARE_API_TOKENorg secret and theCLOUDFLARE_ACCOUNT_IDorg variable. The build job does not change and has no access to the token.Verification
Run locally with Wrangler 4.145.0 against the current production build (the
github-pagesartifact from main):wrangler deploy --dry-run --config docs/wrangler.jsonc: config is valid, 372 files read.wrangler devwith this exact config:/,/index.html,/tutorials/,/explanation/,/how-to/,/reference/,/_modules/,/genindex.html,/search.html?q=var,/objects.inv,/sitemap.xml,/render-mode.txtand/_static/basic.cssall return 200./nope.htmlreturns 404. Both redirect rules parse.html_extra_pathcopies_redirectsto the output root and thatwrangler.jsoncdoes not leak into the site.ruff check,ruff format --checkandactionlintpass.After the merge: the job attaches
impulso-next.quantclimate.com. Then check that the URLs above behave the same on that hostname and that page views appear in Cloudflare Web Analytics under that host.Before merging
The
CLOUDFLARE_API_TOKENorg secret must exist. Without it, the new job fails onmain.🤖 Generated with Claude Code
https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ