Skip to content

Commit e1b24cd

Browse files
committed
Commit schedule opengraph image
1 parent 171a059 commit e1b24cd

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { ImageResponse } from "next/og"
2+
3+
import { loadFontsForOG } from "@/app/fonts/og/load-fonts-for-og"
4+
5+
import { schedule } from "../../_data"
6+
import ScheduleOpengraphImage from "../../components/session-opengraph-image"
7+
8+
export const contentType = "image/png"
9+
export const size = {
10+
width: 1200,
11+
height: 630,
12+
}
13+
14+
export function generateStaticParams() {
15+
return schedule.filter(s => s.id).map(s => ({ id: s.id }))
16+
}
17+
18+
export default async function SpeakerOGImage({
19+
params,
20+
}: {
21+
params: { id: string }
22+
}) {
23+
const decodedId = decodeURIComponent(params.id)
24+
const session = schedule.find(s => s.id === decodedId)
25+
26+
if (!session) {
27+
throw new Error(`Speaker not found: ${decodedId}`)
28+
}
29+
30+
const fonts = loadFontsForOG()
31+
32+
return new ImageResponse(
33+
(
34+
<ScheduleOpengraphImage
35+
session={session}
36+
date="September 8-10"
37+
year="2025"
38+
location="Amsterdam, Netherlands"
39+
/>
40+
),
41+
{
42+
...size,
43+
fonts: await fonts,
44+
},
45+
)
46+
}

src/app/conf/2025/speakers/[id]/opengraph-image.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { ImageResponse } from "next/og"
2-
import { readFile } from "node:fs/promises"
3-
import { resolve } from "node:path"
42

53
import { loadFontsForOG } from "@/app/fonts/og/load-fonts-for-og"
64

0 commit comments

Comments
 (0)