← All packages

@lacspace/og

v1.1.1SEO Kit0 deps

Dynamic Open Graph images — a share-card design system you configure once and call per page. Produces a next/og element tree AND a zero-dependency SVG from the same options, with auto-fitting titles, presets, badges and gradients. Zero-dependency, isomorphic.

npm i @lacspace/og

Usage

og.ts
// app/og/route.tsx
import { ImageResponse } from "next/og";
import { ogCard } from "@lacspace/og";

export const runtime = "edge";

export function GET(req: Request) {
  const title = new URL(req.url).searchParams.get("title") ?? "My site";
  return new ImageResponse(
    ogCard({
      title,
      eyebrow: "Guide",
      subtitle: "my-site.com",
      logo: "M",
      from: "#22d3ee",
      to: "#6366f1",
    }) as any,
    { width: 1200, height: 630 },
  );
}

Exports 9

fitFontSizeogArticleogCardogCardMinimalogCardSplitogProductogSvgogSvgDataUriogThemes

Keywords

og-imageopen-graphopengraphsocial-imagesocial-cardnext-og

More in SEO Kit