How to fix missing og image on Gatsby

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 Gatsby

  1. Create or open your shared SEO component (e.g. src/components/Seo.jsx). This component will use Gatsby's built-in Head API (Gatsby ≥ 4.19) — no extra library needed.
  2. Accept an `ogImage` prop (absolute URL string). Fall back to a default site-wide OG image stored in `static/` (e.g. `static/og-default.jpg`) whose absolute URL is pulled from `siteMetadata.siteUrl` via a `useStaticQuery` GraphQL call.
  3. Inside the component's JSX (returned from the Head export or rendered inside <Head>), add the four required OG image tags: `og:image`, `og:image:width`, `og:image:height`, and `twitter:image`.
  4. Export the `Seo` component and re-export it as the named `Head` export from every page file (e.g. `src/pages/index.jsx`, `src/pages/products/{product.handle}.jsx`) so Gatsby injects the tags into <head> at build time.
  5. For dynamic pages (product/collection PDPs), pass the page's own image URL as the `ogImage` prop (sourced from your CMS/commerce API during `createPages` or via the page's GraphQL query).
  6. Run `gatsby build && gatsby serve` and validate the tags with the LinkedIn Post Inspector or Facebook Sharing Debugger — confirm `og:image` resolves to a publicly reachable absolute URL.
Official Gatsby 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 Gatsby 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