getwowlink
Next.jsgetwowlink
NEXT.JS

Next.js OG images for every route

One generateMetadata function in the App Router. Every route passes its own path — static, dynamic and catch-all.

Get startedAbout 3 minutes · App Router, Next.js 13.4+

Make your preview

Paste your site, pick a design and publish. Open Add to site → Next.js — the snippet already has your site ID.

getwowlink, Add to site on the Next.js tab with the code to copy

Add generateMetadata

Put it in the root catch-all page, or in each route’s page.tsx. Remove other openGraph.images you set.

app/[[...slug]]/page.tsx
// app/[[...slug]]/page.tsx (or any layout)
import type { Metadata } from "next";

export async function generateMetadata({ params }: { params: Promise<{ slug?: string[] }> }): Promise<Metadata> {
  const { slug } = await params;
  const path = (slug ?? []).map(encodeURIComponent).join("/") || "index";
  const image = "https://getwowimg.com/a1b2c3d4e5/" + path + ".png";
  return {
    openGraph: { images: [{ url: image, width: 1200, height: 630 }] },
    twitter: { card: "summary_large_image", images: [image] },
  };
}
a1b2c3d4e5 is a sample site ID — Add to site gives you the code with yours.

Pages Router?

Add the same og:image and twitter tags inside <Head>, building the path from router.asPath. Statically optimised dynamic routes see the route pattern at build time, so use it on pages with getStaticProps or SSR — or the App Router snippet.

pages/_app.tsx · Pages Router
import type { AppProps } from "next/app";
import Head from "next/head";
import { useRouter } from "next/router";

export default function App({ Component, pageProps }: AppProps) {
  const { asPath } = useRouter();
  const path = asPath.split(/[?#]/)[0].replace(/^\/+|\/+$/g, "") || "index";
  const image = "https://getwowimg.com/a1b2c3d4e5/" + path + ".png";
  return (
    <>
      <Head>
        <meta property="og:image" content={image} key="og:image" />
        <meta name="twitter:card" content="summary_large_image" key="twitter:card" />
        <meta name="twitter:image" content={image} key="twitter:image" />
      </Head>
      <Component {...pageProps} />
    </>
  );
}
a1b2c3d4e5 is a sample site ID — Add to site gives you the code with yours.

Optional: see what your shares bring

Keep the visit script and Analytics counts the visits your shared links bring, and from which apps: X, LinkedIn, Facebook, WhatsApp, Telegram. A new page also gets its image on its first visit, before anyone shares it. No cookies, no visitor IDs. The snippet adds it to your root layout while Track visits from shares is on in Add to site, as it is by default.

app/layout.tsx · inside <body>
<Script src="https://getwowimg.com/v.js" data-site="a1b2c3d4e5" strategy="afterInteractive" />
a1b2c3d4e5 is a sample site ID — Add to site gives you the code with yours.
How visit analytics works
Shares and visitsyourproduct.com · last 30 days
Example data
Visits from shares2,199+38%
Preview fetches6,240
First shares ready96%
906030
Blog design live · Sep 12+38% since the Blog design went live
Aug 31Sep 12Sep 29
By platform
X902
LinkedIn594
Telegram352
Slack220
Other131

Deploy and check

Deploy, then paste any page link into the OG checker.

Open the OG checker
LinkedInLooks good
[Brand]Turn shares into clicksyourproduct.com
Launch week: everything we shippedyourproduct.com

Before and after

BEFORE · no og:image
Your brand@yourbrand · 2m
New post is live
yourproduct.comLaunch week: everything we shipped
AFTER · getwowlink
Your brand@yourbrand · 2m
New post is live
[Brand]Turn shares into clicksyourproduct.com
yourproduct.com

Questions

Does it work with static export?

Yes. The image URL is computed at build time; the image itself is rendered by us on request.

What about opengraph-image.tsx?

Remove it for routes that should use getwowlink, otherwise Next.js adds a second og:image.

Will it slow down my pages?

No. It’s one string per page; the image is served from our CDN.

Try it on your site

Three designs made from your site — no sign-up to try.