@@ -4,12 +4,115 @@ export const runtime = 'edge'
44export const size = { width : 1200 , height : 630 }
55export const contentType = 'image/png'
66
7- export default function OGImage ( ) {
7+ /** Match PageHero + page-shell-main (globals.css) — same palette and hierarchy as the live site. */
8+ async function loadGoogleFontWoff2 ( family : string , weight : number ) : Promise < ArrayBuffer > {
9+ const familyParam = family . replace ( / \s + / g, '+' )
10+ const cssUrl = `https://fonts.googleapis.com/css2?family=${ familyParam } :wght@${ weight } &display=swap`
11+ const css = await fetch ( cssUrl , {
12+ headers : {
13+ 'User-Agent' :
14+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' ,
15+ } ,
16+ } ) . then ( ( r ) => r . text ( ) )
17+ const m = css . match ( / u r l \( ( h t t p s : \/ \/ f o n t s \. g s t a t i c \. c o m [ ^ ) ] + ) \) \s + f o r m a t \( [ ' " ] w o f f 2 [ ' " ] \) / )
18+ if ( ! m ) throw new Error ( `woff2 not found for ${ family } ` )
19+ return fetch ( m [ 1 ] ) . then ( ( r ) => r . arrayBuffer ( ) )
20+ }
21+
22+ export default async function OGImage ( ) {
23+ let fonts : {
24+ name : string
25+ data : ArrayBuffer
26+ weight : 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
27+ style : 'normal' | 'italic'
28+ } [ ] = [ ]
29+
30+ try {
31+ const [ gothic , sans ] = await Promise . all ( [
32+ loadGoogleFontWoff2 ( 'Unifraktur Maguntia' , 400 ) ,
33+ loadGoogleFontWoff2 ( 'Inter' , 400 ) ,
34+ ] )
35+ fonts = [
36+ { name : 'UnifrakturMaguntia' , data : gothic , weight : 400 , style : 'normal' } ,
37+ { name : 'Inter' , data : sans , weight : 400 , style : 'normal' } ,
38+ ]
39+ } catch {
40+ // Fallback: system stacks still get correct colors/layout from the real site
41+ }
42+
843 return new ImageResponse (
9- < div style = { { background : '#1a1a1a' , width : '100%' , height : '100%' , display : 'flex' , flexDirection : 'column' , alignItems : 'center' , justifyContent : 'center' } } >
10- < div style = { { fontSize : 80 , color : '#f5f0e8' } } > 🪦</ div >
11- < div style = { { fontSize : 56 , color : '#f5f0e8' , fontFamily : 'serif' , marginTop : 16 } } > commitmentissues</ div >
12- < div style = { { fontSize : 22 , color : '#8b7355' , fontFamily : 'monospace' , marginTop : 12 } } > death certificates for abandoned GitHub repos</ div >
13- </ div >
44+ (
45+ < div
46+ style = { {
47+ background : '#e8e8e8' ,
48+ width : '100%' ,
49+ height : '100%' ,
50+ display : 'flex' ,
51+ flexDirection : 'column' ,
52+ alignItems : 'center' ,
53+ justifyContent : 'center' ,
54+ padding : 48 ,
55+ } }
56+ >
57+ < div
58+ style = { {
59+ display : 'flex' ,
60+ flexDirection : 'column' ,
61+ alignItems : 'center' ,
62+ justifyContent : 'center' ,
63+ maxWidth : 920 ,
64+ textAlign : 'center' ,
65+ } }
66+ >
67+ < div style = { { fontSize : 72 , lineHeight : 1 , marginBottom : 12 } } > 🪦</ div >
68+ < div
69+ style = { {
70+ fontSize : 88 ,
71+ lineHeight : 0.95 ,
72+ color : '#160a06' ,
73+ fontFamily : fonts . length ? 'UnifrakturMaguntia' : 'Georgia, Times New Roman, serif' ,
74+ margin : '12px 0 20px 0' ,
75+ } }
76+ >
77+ Certificate of Death
78+ </ div >
79+ < div
80+ style = { {
81+ fontSize : 26 ,
82+ lineHeight : 1.35 ,
83+ color : '#5f5f5f' ,
84+ fontFamily : fonts . length ? 'Inter' : 'system-ui, -apple-system, sans-serif' ,
85+ maxWidth : 560 ,
86+ } }
87+ >
88+ For projects that never got a goodbye.
89+ </ div >
90+ < div
91+ style = { {
92+ marginTop : 36 ,
93+ height : 1 ,
94+ width : '100%' ,
95+ maxWidth : 640 ,
96+ background : '#bfbfbf' ,
97+ } }
98+ />
99+ < div
100+ style = { {
101+ marginTop : 20 ,
102+ fontSize : 15 ,
103+ letterSpacing : '0.04em' ,
104+ color : '#8a8a8a' ,
105+ fontFamily : fonts . length ? 'Inter' : 'ui-monospace, monospace' ,
106+ } }
107+ >
108+ commitmentissues.dev
109+ </ div >
110+ </ div >
111+ </ div >
112+ ) ,
113+ {
114+ ...size ,
115+ fonts : fonts . length ? fonts : undefined ,
116+ } ,
14117 )
15118}
0 commit comments