Commit d827b3f
feat: OG image generation — workers-og + 4 templates + rawFonts Vite plugin (Track D) (#681)
Dynamic OG image generation on Cloudflare Workers using workers-og + Satori.
Infrastructure:
- rawFonts Vite plugin: inlines .ttf as Uint8Array at build time (CF Workers have no filesystem)
- Inter Bold + Regular v4.1 TTF fonts from official release
- Shared og-utils.ts: brand tokens, TYPE_COLORS, font loading, HTML generation (DRY)
Endpoints (all SSR, prerender=false):
- /api/og/blog.png — title, author, type badge, content-type color coding
- /api/og/podcast.png — amber accent, optional episodeNumber
- /api/og/author.png — author-focused layout
- /api/og/default.png — simpler fallback layout
Features:
- 1200x630 PNG, dark gradient background, violet accent
- Adaptive title font sizing (42/48/56px based on length)
- Author initials avatar with gradient
- Cache: 1 day browser, 7 day edge (public, max-age=86400, s-maxage=604800)
SocialMeta.astro component wires og:image URLs into page meta tags.
Co-authored-by: seniordeveloper <seniordeveloper@miriad.systems>1 parent 84fe5c2 commit d827b3f
File tree
10 files changed
+646
-11
lines changed- apps/web
- src
- assets/fonts
- lib
- pages/api/og
10 files changed
+646
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 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 | + | |
12 | 39 | | |
13 | 40 | | |
14 | 41 | | |
| |||
31 | 58 | | |
32 | 59 | | |
33 | 60 | | |
34 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
35 | 67 | | |
36 | 68 | | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments