Skip to content

Commit df265e7

Browse files
committed
wip
1 parent 6ea6cad commit df265e7

File tree

10 files changed

+564
-95
lines changed

10 files changed

+564
-95
lines changed

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
/// <reference types="next/navigation-types/compat/navigation" />
44

55
// NOTE: This file should not be edited
6-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@tailwindcss/container-queries": "^0.1.1",
2727
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
2828
"@tailwindcss/typography": "^0.5.15",
29+
"@vercel/og": "^0.6.8",
2930
"autoprefixer": "^10.4.20",
3031
"clsx": "^2.1.1",
3132
"codemirror": "^5.65.19",
@@ -41,7 +42,7 @@
4142
"markdown-to-jsx": "^7.7.2",
4243
"marked": "5.1.2",
4344
"motion": "^12.11.0",
44-
"next": "^14.2.22",
45+
"next": "^15.3.3",
4546
"next-image-export-optimizer": "^1.18.0",
4647
"next-query-params": "^5.0.1",
4748
"next-sitemap": "^4.2.3",

pnpm-lock.yaml

Lines changed: 481 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/conf/2025/components/speaker-card.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import clsx from "clsx"
22
import Image from "next-image-export-optimizer"
33

4-
import { eventsColors } from "../utils"
5-
64
import { Anchor } from "../../_design-system/anchor"
7-
import { Tag } from "../../_design-system/tag"
85
import { SchedSpeaker } from "../../2023/types"
96
import { StripesDecoration } from "../../_design-system/stripes-decoration"
107

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ImageResponse } from "next/og"
2+
import { readFile } from "node:fs/promises"
3+
import { resolve } from "node:path"
4+
5+
import { loadFontsForOG } from "@/app/fonts/og/load-fonts-for-og"
6+
7+
import { speakers } from "../../_data"
8+
9+
export const contentType = "image/png"
10+
export const size = {
11+
width: 1200,
12+
height: 630,
13+
}
14+
15+
// This doesn't seem to work?
16+
export function generateStaticParams() {
17+
// return speakers.map(s => ({ id: s.username }))
18+
return [{ id: "aditi_rajawat" }]
19+
}
20+
21+
export default async function SpeakerOGImage({
22+
params,
23+
}: {
24+
params: { id: string }
25+
}) {
26+
const decodedId = decodeURIComponent(params.id)
27+
const speaker = speakers.find(s => s.username === decodedId)
28+
29+
if (!speaker) {
30+
throw new Error(`Speaker not found: ${decodedId}`)
31+
}
32+
33+
// TODO: The fonts need to be in .woff, not .woff2.
34+
const fonts = loadFontsForOG()
35+
36+
return new ImageResponse(
37+
(
38+
<div className="size-full">
39+
<h1 className="font-mono">{params.id}</h1>
40+
<p className="typography-body-lg">
41+
{speaker?.name} is speaking at GraphQLConf 2025.
42+
</p>
43+
</div>
44+
),
45+
{
46+
...size,
47+
fonts: await fonts,
48+
},
49+
)
50+
}

src/app/conf/2025/speakers/[id]/page.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export function generateMetadata({ params }: SpeakerProps): Metadata {
3434
title: speaker.name,
3535
description: speaker.about,
3636
keywords: [...layoutMetadata.keywords, ...keywords],
37-
openGraph: {
38-
images: `/img/__og-image/2024/${speaker.username}.png`,
39-
},
4037
}
4138
}
4239

268 KB
Binary file not shown.
58.1 KB
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { ImageResponse } from "next/og"
2+
3+
import { readFile } from "node:fs/promises"
4+
import { resolve } from "node:path"
5+
6+
type FontOptions = NonNullable<
7+
NonNullable<ConstructorParameters<typeof ImageResponse>[1]>["fonts"]
8+
>[number]
9+
10+
/**
11+
* Fonts used in Open Graph images must be .ttf or .woff due to a limitation in opentype.js.
12+
* @see https://github.com/vercel/satori/discussions/157.
13+
* Variable fonts are flaky and inconsistent with `@vercel/og`.
14+
* @see https://github.com/vercel/satori/issues/320
15+
*/
16+
export async function loadFontsForOG(): Promise<FontOptions[]> {
17+
const cwd = process.cwd()
18+
const dirname = "src/app/fonts/og"
19+
return [
20+
{
21+
data: await readFile(resolve(cwd, dirname, "HostGrotesk-Regular.ttf")),
22+
name: "Host Grotesk",
23+
},
24+
{
25+
data: await readFile(resolve(cwd, dirname, "CommitMono-400-Regular.ttf")),
26+
name: "Commit Mono",
27+
},
28+
]
29+
}

src/github-stats.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

0 commit comments

Comments
 (0)