Skip to content

Commit 284e4e2

Browse files
committed
render OG preview at actual platform sizes (Twitter, Slack, iMessage)
1 parent 1f632c6 commit 284e4e2

1 file changed

Lines changed: 30 additions & 14 deletions

File tree

  • packages/app/src/app/blog/og-preview

packages/app/src/app/blog/og-preview/page.tsx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,42 @@ const VARIANTS = [
5050
{ id: 'v25', name: 'V25: Gold Accent Stripe — Thick gold left stripe, massive title, minimal' },
5151
];
5252

53+
// Common platform render sizes for OG images
54+
const SIZES = [
55+
{ label: 'Full (1200×630)', w: 1200, h: 630 },
56+
{ label: 'Twitter/X (~500×262)', w: 500, h: 262 },
57+
{ label: 'Slack (~360×189)', w: 360, h: 189 },
58+
{ label: 'iMessage (~300×157)', w: 300, h: 157 },
59+
];
60+
5361
export default function OgPreviewPage() {
5462
return (
55-
<main className="container mx-auto px-4 py-12 max-w-5xl">
63+
<main className="container mx-auto px-4 py-12 max-w-7xl">
5664
<h1 className="text-3xl font-bold mb-2">OG Image Variants Preview</h1>
57-
<p className="text-muted-foreground mb-8">
58-
25 variants. V1–V10: generic. V11–V15: brand palette. V16–V20: GSA slide style. V21–V25:
59-
optimized for small render size (huge text, no fine details).
65+
<p className="text-muted-foreground mb-10">
66+
Each variant shown at actual platform render sizes. V1–V10: generic. V11–V15: brand palette.
67+
V16–V20: GSA slide style. V21–V25: thumbnail-optimized.
6068
</p>
61-
<div className="flex flex-col gap-10">
69+
<div className="flex flex-col gap-14">
6270
{VARIANTS.map((v) => (
63-
<div key={v.id} className="flex flex-col gap-2">
71+
<div key={v.id} className="flex flex-col gap-3">
6472
<h2 className="text-lg font-semibold">{v.name}</h2>
65-
{/* eslint-disable-next-line @next/next/no-img-element */}
66-
<img
67-
src={`/api/og-preview?slug=hello-world&v=${v.id}`}
68-
alt={v.name}
69-
width={1200}
70-
height={630}
71-
className="w-full rounded-lg border border-border"
72-
/>
73+
<div className="flex flex-wrap gap-4 items-end">
74+
{SIZES.map((s) => (
75+
<div key={s.label} className="flex flex-col gap-1">
76+
<span className="text-xs text-muted-foreground">{s.label}</span>
77+
{/* eslint-disable-next-line @next/next/no-img-element */}
78+
<img
79+
src={`/api/og-preview?slug=hello-world&v=${v.id}`}
80+
alt={`${v.name} at ${s.label}`}
81+
width={s.w}
82+
height={s.h}
83+
style={{ width: s.w, height: s.h }}
84+
className="rounded border border-border"
85+
/>
86+
</div>
87+
))}
88+
</div>
7389
</div>
7490
))}
7591
</div>

0 commit comments

Comments
 (0)