I’m trying to get OG Image Generation setup for my site and following the documentation and I’m a bit lost.
- To begin the
headit’s pointing to the followinghttps://og-examples.vercel.sh/api/staticin the example code. Is this the new site created earlier or would this be your existing site and thestaticis confusing me as well since nothing I created was static. - If I browse to
http://localhost:3000/api/ogas the documents suggest I’m routed to my notFound page
<head>
<title>Hello world</title>
<meta
property="og:image"
content="https://og-examples.vercel.sh/api/static"
/>
</head>
If I implement the above as shown it works, but is not what i placed in my app/api/log. Would I implement this into my existing app or do I stand up a new app?
I would see the sample code I placed in app/api/log
My Router in app.jsx. Would I need to update my vercel.json to account for api/log
<BrowserRouter>
...
<Route path="*" element={<AboutModal />} />
</Routes>
</div>
</BrowserRouter>
import { ImageResponse } from 'next/og';
// App router includes @vercel/og.
// No need to install it.
export async function GET() {
return new ImageResponse(
(
<div
style={{
fontSize: 40,
color: 'black',
background: 'white',
width: '100%',
height: '100%',
padding: '50px 200px',
textAlign: 'center',
justifyContent: 'center',
alignItems: 'center',
}}
>
👋 Hello
</div>
),
{
width: 1200,
height: 630,
},
);
}
```
<!-- Project information (URL, framework, environment, project settings) -->
* www.hotscots.app
* React site
