Skip to content

fix(worker): repair bot-facing snapshot HTML at the edge (temporary, until #29 deploys) - #30

Merged
gogrowth-co merged 1 commit into
mainfrom
fix/worker-edge-snapshot-repair
Aug 23, 2026
Merged

fix(worker): repair bot-facing snapshot HTML at the edge (temporary, until #29 deploys)#30
gogrowth-co merged 1 commit into
mainfrom
fix/worker-edge-snapshot-repair

Conversation

@gogrowth-co

Copy link
Copy Markdown
Owner

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 carry x-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

…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]>
@netlify

netlify Bot commented Aug 23, 2026

Copy link
Copy Markdown

Deploy Preview for mangabeira ready!

Name Link
🔨 Latest commit 863f839
🔍 Latest deploy log https://app.netlify.com/projects/mangabeira/deploys/6a8b46a4908018000876cc1f
😎 Deploy Preview https://deploy-preview-30--mangabeira.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: gogrowth-co/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f9bc65fd-3a6d-4dad-908e-b66389ab3bfb


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gogrowth-co
gogrowth-co merged commit 57ea759 into main Aug 23, 2026
5 of 8 checks passed
@gogrowth-co
gogrowth-co deleted the fix/worker-edge-snapshot-repair branch August 23, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants