Commit e4eff6b
feat(og): dynamic package-themed OG images (#835)
* chore: add satori and resvg-js for dynamic OG image generation
* chore: add Inter TTF fonts for Satori OG generation
* feat(og): add library accent color map
* feat(og): module-scope loader for Satori fonts and island asset
* feat(og): Satori JSX template for package OG images
* feat(og): PNG generator via Satori and resvg
* chore(og): add preview script for local visual verification
* feat(og): add doc-title slot between library name and description
* feat(og): /api/og/:library.png resource route with CDN cache headers
* test(smoke): cover /api/og endpoint with status + content-type assertions
* feat(og): ogImageUrl helper for SEO call sites
* feat(og): use generated OG image on library landing pages
* feat(og): use generated OG image on docs pages
* chore(og): remove unused static ogImage fields from libraries
* fix(og): clamp title length, drop unused color export, include fonts in function bundle
* ci: apply automated fixes
* feat(og): separate pitch slot from description, fix slot order
* feat(og): show pitch only on landing pages (no doc title or description)
* fix(og): add empty alt to decorative island img for lint
* refactor(og): migrate satori + resvg to takumi
Swap the two-stage satori (JSX→SVG) + resvg-js (SVG→PNG) pipeline for
takumi's single-stage Rust renderer. Smaller PNGs (~22%) and faster
cold start on the Netlify function.
The island PNG moves from an inline base64 data URL to takumi's
persistent-image cache, referenced by key. Route handler now returns
the ImageResponse directly instead of wrapping a Buffer.
* fix(og): use deploy origin for og:image so previews resolve
canonicalUrl always returns the production hostname, so on Netlify
preview/branch deploys the og:image meta tag pointed at
https://tanstack.com/api/og/<id>.png — which 404s if production
hasn't shipped the endpoint yet, making validators report the
image as invalid/unreachable.
og:image now prefers DEPLOY_PRIME_URL → DEPLOY_URL → URL → SITE_URL
on SSR, so each deploy emits a same-origin og:image URL. Production
behavior is unchanged (DEPLOY_PRIME_URL === URL on production builds).
Canonical link tags continue to use canonicalUrl and point to prod.
* Merge branch 'main' into feat/dynamic-og-images
* fix(og): address coderabbit review
- Inter-Regular registered with weight 400 (was 700) — matches the
font file and pairs cleanly with Inter-ExtraBold at 800 so template
fontWeight 500 resolves to the closer regular face.
- Tighten LIBRARY_ACCENT_COLORS to Partial<Record<LibraryId, string>>
so removing or renaming a library id is a TS error rather than a
silent fallback to the default. getAccentColor takes LibraryId now.
- Share MAX_OG_TITLE_LENGTH / MAX_OG_DESCRIPTION_LENGTH / clampOgText
via src/utils/og-limits.ts and clamp client-side in ogImageUrl so
the og:image URL stays bounded and CDN cache keys stay stable.
- Hoist duplicated title/description strings in the examples route
head() so seo() and ogImageUrl() can't drift.
- Smoke tests: add a 404 assertion for unknown library ids, and
report HTML / OG / Total counts separately so a mid-run "X passed"
isn't misleading.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Sarah Gerrard <gerrardsarah@gmail.com>1 parent e51f9b0 commit e4eff6b
39 files changed
Lines changed: 736 additions & 45 deletions
File tree
- public/fonts
- scripts
- src
- libraries
- routes
- $libraryId
- api/og
- server/og
- utils
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
0 commit comments