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

Commit e9c88c0

Browse files
committed
fix og
1 parent f596e93 commit e9c88c0

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
@@ -2,13 +2,17 @@ import { BASE_URL } from '@/lib/constants'
22
import { ImageResponse } from 'next/og'
33
import { NextRequest } from 'next/server'
44

5-
//export const runtime = 'edge'
5+
export const runtime = 'edge'
66

77
const size = {
88
width: 1200,
99
height: 630,
1010
}
1111

12+
const font = fetch(new URL('../../assets/Sora-Bold.ttf', import.meta.url)).then(
13+
(res) => res.arrayBuffer(),
14+
)
15+
1216
// Image generation
1317
export async function GET(req: NextRequest) {
1418
const { searchParams } = req.nextUrl
@@ -24,15 +28,6 @@ export async function GET(req: NextRequest) {
2428
? searchParams.get('description')?.slice(0, 100)
2529
: 'Docs for the Nitric cloud application framework.'
2630

27-
const imageBaseUrl = req.headers.get('host')?.startsWith('localhost')
28-
? `http://${req.headers.get('host')}`
29-
: `https://${req.headers.get('host')}`
30-
31-
// Font
32-
const soraBold = fetch(
33-
new URL('../../assets/Sora-Bold.ttf', import.meta.url),
34-
).then((res) => res.arrayBuffer())
35-
3631
return new ImageResponse(
3732
(
3833
// ImageResponse JSX element
@@ -103,7 +98,7 @@ export async function GET(req: NextRequest) {
10398
fonts: [
10499
{
105100
name: 'Sora',
106-
data: await soraBold,
101+
data: await font,
107102
style: 'normal',
108103
weight: 600,
109104
},

0 commit comments

Comments
 (0)