-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from Illyism/og
improve metadata defaults + og image
- Loading branch information
Showing
6 changed files
with
169 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* eslint-disable @next/next/no-img-element */ | ||
import { ImageResponse } from "next/og"; | ||
import { NextRequest } from "next/server"; | ||
|
||
export const runtime = "edge"; | ||
|
||
/** | ||
* @name Headline Template | ||
* @description Make it pop with a headline | ||
*/ | ||
export async function GET(request: NextRequest) { | ||
const searchParams = request.nextUrl.searchParams; | ||
const title = searchParams.get("title") || "Papermark Document"; | ||
const Inter = await fetch( | ||
new URL("@/public/_static/Inter-Bold.ttf", import.meta.url), | ||
).then((res) => res.arrayBuffer()); | ||
|
||
return new ImageResponse( | ||
( | ||
<div tw="flex flex-col items-center justify-between w-full h-full bg-white text-black p-12"> | ||
<div tw="text-[32px] flex items-center tracking-tighter">Papermark</div> | ||
<div tw="text-[42px] text-center">{title}</div> | ||
<div tw="text-[32px] flex items-center"> | ||
Open-Source Document Sharing | ||
</div> | ||
</div> | ||
), | ||
{ | ||
width: 1200, | ||
height: 630, | ||
headers: { | ||
"Cache-Control": "public, max-age=3600, immutable", | ||
}, | ||
fonts: [ | ||
{ | ||
name: "Inter", | ||
data: Inter, | ||
}, | ||
], | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.