How to fix missing og image on Next.js (Headless)

Add an og:image meta tag to every page so that social media platforms and messaging apps display a rich, branded image preview whenever someone shares your store's link.

Steps for Next.js (Headless)

  1. Place a high-quality branded fallback image (e.g. og-image.jpg, 1200×630 px) inside the /public directory so it is served statically at /og-image.jpg.
  2. In your root layout (app/layout.tsx) export a `metadata` object (or `generateMetadata`) that sets `openGraph.images` with the absolute URL of that fallback image — use `metadataBase` so Next.js can resolve relative paths to absolute URLs automatically.
  3. Override `openGraph.images` inside every dynamic route's `generateMetadata` function (e.g. app/products/[slug]/page.tsx) to supply a product-specific image pulled from your commerce API, with the static fallback as a safe default.
  4. For any remaining static pages (e.g. app/about/page.tsx, app/collections/page.tsx), export a local `metadata` object with `openGraph.images` set to at least the fallback URL.
  5. Run `next build` and verify the rendered HTML contains `<meta property="og:image" content="https://…">` with a fully-qualified URL on every page type.
  6. Optionally add `twitter:image` via `metadata.twitter.images` in the same objects so Twitter/X card previews also display the image.
Official Next.js (Headless) documentation ↗

What is missing og image?

The og:image tag is a small snippet of HTML code placed in the invisible "head" section of your web pages. It tells social networks (Facebook, LinkedIn, Pinterest, X/Twitter, iMessage, WhatsApp, Slack, and more) which image to show when someone shares or previews a link to your page. Without it, those platforms either show no image at all, pick one randomly from your page (often a logo, icon, or a totally irrelevant graphic), or display a plain grey box — all of which look unprofessional and untrustworthy. The Open Graph protocol (the "og:" prefix) is a widely adopted web standard originally created by Facebook and now used by virtually every major platform.

When a customer shares your product page in a Facebook group, on Pinterest, or in a WhatsApp message, the link preview is often the first visual impression a new potential buyer gets — before they ever visit your site. A missing or broken og:image means that preview is blank, random, or ugly, dramatically reducing click-through rates and undermining trust in your brand. Studies consistently show that posts with compelling images receive far more clicks, shares, and engagement than text-only links. For ecommerce stores especially, a crisp product image in a shared link can directly drive impulse purchases and word-of-mouth traffic at zero extra ad spend. There is also a secondary SEO benefit: platforms like Pinterest drive significant referral traffic, and proper og:image tagging is required for Rich Pins, which surface your product price and availability alongside the image.

See the complete Missing og image guide for every platform and the full background.

Not sure if your Next.js (Headless) store has this?

Run a free SEOLZ scan — we’ll find missing og image and every other issue across your whole site.

Scan my site free

Fix missing og image on another platform