Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 3bb41e8

Browse files
authored
fix og (#633)
1 parent 5bdd522 commit 3bb41e8

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/app/og/route.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,12 @@ const font = fetch(new URL('../../assets/Sora-Bold.ttf', import.meta.url)).then(
1616
// Image generation
1717
export async function GET(req: NextRequest) {
1818
const { searchParams } = req.nextUrl
19-
// ?title=<title>
20-
const hasTitle = searchParams.has('title')
21-
const title = hasTitle
22-
? searchParams.get('title')?.slice(0, 100)
23-
: 'Nitric Docs'
2419

25-
const hasDescription = searchParams.has('description')
20+
const title = searchParams.get('title')?.slice(0, 100) || 'Nitric Docs'
2621

27-
const description = hasDescription
28-
? searchParams.get('description')?.slice(0, 100)
29-
: 'Docs for the Nitric cloud application framework.'
22+
const description =
23+
searchParams.get('description')?.slice(0, 100) ||
24+
'Docs for the Nitric cloud application framework.'
3025

3126
return new ImageResponse(
3227
(
@@ -76,15 +71,15 @@ export async function GET(req: NextRequest) {
7671
textAlign: 'left',
7772
}}
7873
>
79-
{title}
74+
{decodeURIComponent(title)}
8075
<div
8176
style={{
8277
color: '#A1A1AA',
8378
fontSize: '28px',
8479
fontWeight: 500,
8580
}}
8681
>
87-
{description}
82+
{decodeURIComponent(description)}
8883
</div>
8984
</div>
9085
<br />

0 commit comments

Comments
 (0)