fix(worker): repair bot-facing snapshot HTML at the edge (temporary, until #29 deploys) - #30
Merged
Merged
Conversation
…rary) The seo-snapshot edge function returns article HTML with no <h1>, no internal links, and — for articles authored in the CMS as complete HTML documents — a second <title> and a second <link rel="canonical"> leaked into <body>. On the BR and ES copies of web2-vs-web3-marketing that leaked canonical points at /publications/web2-vs-web3-marketing-br, which GSC classifies as a Soft 404. Measured as Googlebot (bot UA + Accept: text/html) on 2026-08-23: 91 of 111 live URLs failing — 79 with under 3 internal links, 74 with no <h1>. The real fix is #29, already merged, but it cannot ship: Supabase edge functions on this project deploy only through Lovable Cloud (DEPLOY.md) and that workspace is out of credits. This repairs the response at the edge in the meantime. patchSnapshot() runs only on the bot-snapshot branch and each step is conditional on the defect actually being present: - strips leaked DOCTYPE/html/head/body/title/link/meta from the body - injects an <h1> from the document title only when the body has none - injects a nav with hub/about/tools/audit links only when the page has fewer than 3 internal links So once #29 deploys, every branch becomes a no-op and this stops touching anything. The body is read once up front and the original text is returned on any patch error, so a bug here cannot blank a live article. Responses carry x-snapshot-patched listing what was changed. Verified after deploy: seo-bot-view-guard reports 111/111 pass (was 20/111). Human requests are unaffected — they never reach this branch. Remove after confirming #29 is live. Co-Authored-By: Claude Fable 5 <[email protected]>
✅ Deploy Preview for mangabeira ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: gogrowth-co/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Temporary edge mitigation while #29 cannot deploy (Lovable Cloud out of credits; personal Supabase tokens 403 per DEPLOY.md).
Measured as Googlebot before: 20/111 URLs pass. After deploying this worker: 111/111 pass.
patchSnapshot()runs only on the bot-snapshot branch, and every step is conditional on the defect being present — so when #29 ships, each branch becomes a no-op. Body is read once up front and the original text is returned on any error, so a bug here cannot blank a live article. Responses carryx-snapshot-patched.Already deployed to Cloudflare (script
mangabeira-snapshot-router, modified 2026-08-23T19:12Z) via the API so existing routes were preserved. Human requests never reach this branch and were verified unchanged.Remove this once #29 is deployed and verified.
🤖 Generated with Claude Code