Skip to content

fix: serve og image, sitemap and icon as static assets - #12

Merged
eliahilse merged 1 commit into
mainfrom
fix/og-static
Jul 31, 2026
Merged

fix: serve og image, sitemap and icon as static assets#12
eliahilse merged 1 commit into
mainfrom
fix/og-static

Conversation

@eliahilse

Copy link
Copy Markdown
Owner

#11 shipped an OG card that rendered perfectly at build time and 404'd in production. Two causes:

  1. @takumi-rs/image-response's Node build uses a native binary that cannot run on Cloudflare Workers, so the route could never execute there.
  2. OpenNext does not ship a prerendered route-handler body as a static asset, so the build-time PNG was discarded — the route was expected to run at request time.

/sitemap.xml and /icon.svg 404'd for the same class of reason (route-handler and app-convention outputs that never became assets).

Fix

Everything is now a plain static asset, so nothing has to execute on the edge:

  • scripts/generate-og.tsx renders the card in Node at build time and writes public/og.png; wired into build, deploy, and preview so it can never drift from the design
  • sitemap.xml and icon.svg moved to public/
  • metadata points at /og.png, plus an explicit icons entry
  • the generator fails the build if the pixel font can't be found or the render comes back suspiciously small — the earlier font bug was silent, and this makes that class of failure loud
  • public/og.png is gitignored since it is reproducible from the script

Verified live on kyora.sh

path status
/ 200 text/html
/og.png 200 image/png, 126,193 b
/icon.svg 200 image/svg+xml
/sitemap.xml 200 application/xml
/robots.txt 200 text/plain

og:image and twitter:image both resolve to the live PNG, twitter:card is summary_large_image.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CQy3ZJ5MyUxo4qjZwA93Na

The og route rendered fine at build time but 404'd in production:
takumi's native binary cannot run on Workers, and OpenNext does not
ship a prerendered route-handler body as an asset. The card is now
generated into public/ by a build script instead, and sitemap and icon
moved to public/ for the same reason. Adds a guard so a missing pixel
font fails the build rather than shipping a fallback face.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQy3ZJ5MyUxo4qjZwA93Na
@eliahilse
eliahilse merged commit 0377f54 into main Jul 31, 2026
2 checks passed
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.

1 participant