Simple API to Generate the OG image for website and blogs.
- Next.JS
- Vercel Edge Functions
- Typescript
- Next API Routes
@vercel/ogModule for Generate og image
- API:
/src/app/api/og/route.jsxModify the og image generation according to your needs.
http://localhost:3000/api/og?title=sanweb- Required node.js LTS version (18 or 20)
pnpmpackage manager
npm install -g pnpm- Clone this repo or Download
git clone https://github.com/sanwebinfo/og-image
cd og-image
pnpm install- Test the site
pnpm dev- Build a site
pnpm build- Test the Production build
pnpm start- Open Graph (OG) Image Generation - https://vercel.com/docs/functions/edge-functions/og-image-generation
- Guide to Create OG API using Next.js and vercel - https://blog.dennisokeeffe.com/blog/2022-10-15-using-the-new-vercel-opengraph-image-generation
MIT