File tree Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 1
1
import { ImageResponse } from "next/og"
2
- import { readFile } from "node:fs/promises"
3
- import { resolve } from "node:path"
4
2
5
3
import { loadFontsForOG } from "@/app/fonts/og/load-fonts-for-og"
6
4
You can’t perform that action at this time.
0 commit comments