Skip to content

Commit a8ec3bd

Browse files
committed
WIP 22102
1 parent e996881 commit a8ec3bd

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed
-7.82 KB
Binary file not shown.
-3.99 KB
Binary file not shown.

docs/site/app/api/og/route.tsx

+10-15
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import type { NextApiRequest } from "next/index";
44
import { RepoLogo } from "../../_components/logos/og/repo-logo";
55
import { VercelLogo } from "../../_components/logos/og/vercel-logo";
66

7-
export const config = {
8-
runtime: "edge",
9-
};
7+
export const runtime = "edge";
108

119
function _arrayBufferToBase64(buffer: ArrayBuffer): string {
1210
let binary = "";
@@ -20,7 +18,7 @@ function _arrayBufferToBase64(buffer: ArrayBuffer): string {
2018

2119
export async function GET(req: NextApiRequest): Promise<Response> {
2220
try {
23-
const [geistSans, geistMono, bg] = await Promise.all([
21+
const [geist, geistMono, bg] = await Promise.all([
2422
fetch(new URL("./Geist-Regular.ttf", import.meta.url)).then((res) =>
2523
res.arrayBuffer()
2624
),
@@ -34,11 +32,7 @@ export async function GET(req: NextApiRequest): Promise<Response> {
3432
),
3533
]);
3634

37-
if (!req.url) {
38-
throw new Error("No URL was provided");
39-
}
40-
41-
const { searchParams } = new URL(req.url);
35+
const { searchParams } = new URL(req.url!);
4236

4337
let title: string | null = null;
4438

@@ -57,10 +51,10 @@ export async function GET(req: NextApiRequest): Promise<Response> {
5751
justifyContent: "center",
5852
width: "100%",
5953
height: "100%",
60-
fontFamily: "Geist Sans",
54+
fontFamily: "Geist Mono",
6155
fontWeight: 700,
6256
fontSize: 60,
63-
backgroundImage: `url(${bg})`,
57+
backgroundImage: `url(data:image/jpeg;base64,${bg})`,
6458
backgroundSize: "1200px 630px",
6559
color: "#fff",
6660
}}
@@ -73,7 +67,7 @@ export async function GET(req: NextApiRequest): Promise<Response> {
7367
{title ? (
7468
<div
7569
style={{
76-
fontFamily: "Geist Sans",
70+
fontFamily: "Geist Mono",
7771
fontSize: 36,
7872
letterSpacing: -1.5,
7973
padding: "40px 20px 30px",
@@ -111,24 +105,25 @@ export async function GET(req: NextApiRequest): Promise<Response> {
111105
},
112106
{
113107
name: "Geist Sans",
114-
data: geistSans,
108+
data: geist,
115109
weight: 400 as const,
116110
style: "normal" as const,
117111
},
118112
],
119113
}
120114
);
121115
} catch (err: unknown) {
122-
// Protects us from serving no image at all if something is broken.
116+
// Prevents us from have no OG image at all in production.
123117
if (process.env.VERCEL_ENV === "production") {
124118
return new Response(undefined, {
125119
status: 302,
126120
headers: {
127-
Location: "/og-image.png",
121+
Location: "https://turbo.build/og-image.png",
128122
},
129123
});
130124
}
131125

126+
// We want to see the 500s everywhere else.
132127
return new Response(undefined, {
133128
status: 500,
134129
});

docs/site/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"fumadocs-ui": "^14.7.7",
4040
"geist": "^1.3.0",
4141
"lucide-react": "^0.479.0",
42-
"next": "15.2.2",
42+
"next": "15.2.1-canary.6",
4343
"react": "19.0.0",
4444
"react-dom": "19.0.0",
4545
"remark": "^15.0.1",
@@ -52,8 +52,8 @@
5252
},
5353
"devDependencies": {
5454
"@mdx-js/mdx": "^3.0.1",
55-
"@next/env": "15.2.2",
56-
"@next/eslint-plugin-next": "15.2.2",
55+
"@next/env": "15.2.1-canary.6",
56+
"@next/eslint-plugin-next": "15.2.1-canary.6",
5757
"@turbo/tsconfig": "workspace:^",
5858
"@turbo/types": "2.1.3-canary.1",
5959
"@types/mdx": "^2.0.8",

docs/site/public/og-image.png

69 KB
Loading

0 commit comments

Comments
 (0)