|
| 1 | +/** |
| 2 | + * V24: Gold Split Bold — Left 30% gold with brand stacked vertically, |
| 3 | + * right 70% dark with massive title. Both zones survive at 360px render. |
| 4 | + * No fine details, just color blocks and big text. |
| 5 | + */ |
| 6 | +import { ImageResponse } from 'next/og'; |
| 7 | + |
| 8 | +import type { BlogPostMeta } from '@/lib/blog'; |
| 9 | + |
| 10 | +export const size = { width: 1200, height: 630 }; |
| 11 | + |
| 12 | +const GOLD = '#F7B041'; |
| 13 | +const BLUE = '#0B86D1'; |
| 14 | +const BG = '#131416'; |
| 15 | + |
| 16 | +export function renderOgImage(meta: BlogPostMeta) { |
| 17 | + const titleSize = meta.title.length > 50 ? 52 : meta.title.length > 30 ? 64 : 76; |
| 18 | + |
| 19 | + return new ImageResponse( |
| 20 | + <div style={{ display: 'flex', width: '100%', height: '100%', overflow: 'hidden' }}> |
| 21 | + {/* Left gold panel */} |
| 22 | + <div |
| 23 | + style={{ |
| 24 | + display: 'flex', |
| 25 | + flexDirection: 'column', |
| 26 | + justifyContent: 'space-between', |
| 27 | + width: 340, |
| 28 | + height: '100%', |
| 29 | + backgroundColor: GOLD, |
| 30 | + padding: '50px 40px', |
| 31 | + }} |
| 32 | + > |
| 33 | + <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}> |
| 34 | + <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}> |
| 35 | + <span style={{ fontSize: 36, fontWeight: 800, color: BLUE }}>semi</span> |
| 36 | + <span style={{ fontSize: 36, fontWeight: 800, color: '#444647' }}>analysis</span> |
| 37 | + </div> |
| 38 | + <span style={{ fontSize: 24, color: '#5D5E5F', fontWeight: 600 }}>InferenceX Blog</span> |
| 39 | + </div> |
| 40 | + |
| 41 | + <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}> |
| 42 | + <span style={{ fontSize: 22, color: '#5D5E5F' }}>{meta.author}</span> |
| 43 | + <span style={{ fontSize: 20, color: '#6D6E6F' }}> |
| 44 | + {new Date(meta.date + 'T00:00:00Z').toLocaleDateString('en-US', { |
| 45 | + month: 'short', |
| 46 | + year: 'numeric', |
| 47 | + timeZone: 'UTC', |
| 48 | + })} |
| 49 | + </span> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + |
| 53 | + {/* Right dark panel */} |
| 54 | + <div |
| 55 | + style={{ |
| 56 | + display: 'flex', |
| 57 | + flexDirection: 'column', |
| 58 | + justifyContent: 'center', |
| 59 | + flex: 1, |
| 60 | + backgroundColor: BG, |
| 61 | + padding: '50px 55px', |
| 62 | + }} |
| 63 | + > |
| 64 | + <div style={{ fontSize: titleSize, fontWeight: 800, lineHeight: 1.1, color: '#FFFFFF' }}> |
| 65 | + {meta.title} |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + </div>, |
| 69 | + size, |
| 70 | + ); |
| 71 | +} |
0 commit comments