-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix og image * Update route.tsx * remove vercel og
- Loading branch information
1 parent
77925d7
commit 06b64be
Showing
9 changed files
with
81 additions
and
229 deletions.
There are no files selected for viewing
File renamed without changes.
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,62 @@ | ||
/* eslint react/no-unknown-property: ['error', { ignore: ['tw'] }] */ | ||
import { NextraLogo } from '@components/icons' | ||
import { ImageResponse } from 'next/og' | ||
|
||
export const runtime = 'edge' | ||
|
||
const font = fetch(new URL('./Inter-SemiBold.otf', import.meta.url)).then(res => | ||
res.arrayBuffer() | ||
) | ||
|
||
export async function GET(req: Request): Promise<Response> { | ||
try { | ||
const { searchParams } = new URL(req.url) | ||
|
||
// ?title=<title> | ||
const title = | ||
searchParams.get('title')?.slice(0, 75) || 'Nextra Documentation' | ||
|
||
return new ImageResponse( | ||
( | ||
<div | ||
tw="text-white px-20 py-[70px] bg-[#030303] h-full w-full flex justify-between flex-col" | ||
style={{ | ||
backgroundImage: | ||
'radial-gradient(circle at 25px 25px, #333 2%, transparent 0%), radial-gradient(circle at 75px 75px, #333 2%, transparent 0%)', | ||
backgroundSize: '100px 100px', | ||
backgroundPosition: '-30px -10px' | ||
}} | ||
> | ||
<NextraLogo height="40" /> | ||
<h1 | ||
tw="text-transparent text-[82px] m-0 mb-10 tracking-tighter leading-[1.1]" | ||
style={{ | ||
textShadow: '0 2px 30px #000', | ||
backgroundImage: 'linear-gradient(90deg, #fff 40%, #aaa)', | ||
backgroundClip: 'text' | ||
}} | ||
> | ||
{title} | ||
</h1> | ||
<p tw="m-0 text-3xl tracking-tight"> | ||
Create beautiful websites with Next.js & MDX. | ||
</p> | ||
</div> | ||
), | ||
{ | ||
width: 1200, | ||
height: 630, | ||
fonts: [ | ||
{ | ||
name: 'inter', | ||
data: await font, | ||
style: 'normal' | ||
} | ||
] | ||
} | ||
) | ||
} catch (error) { | ||
console.error(error) | ||
return new Response('Failed to generate the image', { status: 500 }) | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. | ||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. |
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 was deleted.
Oops, something went wrong.
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.