Back to blog

Next.js Blog Post Showing the Wrong Social Preview Image?

Check the live post’s image tags, trace a shared blog image, and give your developer a route-specific fix you can verify after deployment.

Branded cover illustrating a blog post image and its social preview metadata

If a published Next.js post shows the wrong image when shared, start with the post’s live og:image and twitter:image tags. If a tag points to the generic blog image, fix the image configuration for that post’s route; if it points to the intended image, open that image URL and check what it actually serves. Next.js uses Open Graph and Twitter image metadata for shared links, so the article’s visible cover is not enough to diagnose the preview.

Inspect the published post’s image tags

Open the exact public post URL. In the rendered page’s head, record the content values of og:image and twitter:image; Next.js says its generated metadata tags can be inspected in browser developer tools. Open each image URL separately and check whether it loads and shows the intended artwork. A correct-looking tag with an inaccessible or incorrect image is an asset problem; a tag that names the generic artwork points you toward the route’s metadata instead.

Check both tags rather than assuming they match. Next.js provides separate opengraph-image and twitter-image file conventions, each of which adds its corresponding image metadata. If one tag is correct and the other is not, give your developer the differing values and the sharing context where you noticed the problem.

Decide whether the post is using a shared image

Ask the developer to compare the post’s live tags with image configuration in app/, including the root, app/blog/, and app/blog/[slug]/. Next.js allows an Open Graph image deeper in the folder structure to take precedence over one above it. A blog-level image can therefore be appropriate for the blog landing page but wrong for an individual article. Check for file-based images as well as metadata defined in a page or layout before editing either one.

Here is a fictional diagnosis: https://example.com/blog/new-guide displays its own cover in the article, but its live og:image points to the generic blog artwork. The image URL loads, so replacing that asset would also change the shared artwork for other URLs that use it. The better request is to give new-guide a post-specific social image while retaining the generic image where it belongs. If twitter:image already points to the right artwork, leave that working configuration alone; if it also points to the generic image, include it in the fix.

Give your developer a route-specific fix

Choose the implementation based on how images are supplied. For a route with its own ready-to-use image file, Next.js supports placing an opengraph-image file in that route segment; a twitter-image file sets the corresponding Twitter image tag. For a dynamic blog route whose image should vary by slug, Next.js documents app/blog/[slug]/opengraph-image.tsx for generating a distinct Open Graph image from post data. Have the developer use the published post’s actual image source, not a generic fallback that merely produces a new URL.

For the fictional new-guide post, the handoff is: provide the exact post URL, the intended artwork or its accessible asset URL, the current values of both image tags, and a request for og:image to resolve to artwork for new-guide after deployment. Request a twitter:image change only if that tag is wrong too. If the site already derives post metadata from article data, the developer should inspect that mapping and any image files in the route before choosing what to change. A route-specific file and a post-data-driven image generator are alternatives, not extra changes every post needs.

Verify the deployed inputs before judging the share preview

After the fix is deployed, reopen the public article—not a local or draft preview. Confirm the relevant image tags now contain the intended URL, then open each referenced image URL and inspect the artwork. For the fictional example, success means the live new-guide post serves a post-specific og:image whose URL displays the new-guide artwork, while any twitter:image that needed correction does the same. If the public tags are still generic, revisit the deployed route configuration; if the tags are correct but an image URL fails, repair the asset.

A sharing service may still show an older preview even after those live inputs are correct. Treat what the service displays as a separate observation, and check its own preview tools or refresh process if available; do not infer a failed deployment from the preview alone. This is also separate from a Google search-result title or description: use the wrong-title guide or snippet guide for those issues. If the article URL does not load at all, start with the Next.js post 404 guide.

Ranks offers branded article covers and publishes articles on your own blog. That makes the cover useful artwork to consider for this fix, but it does not tell you what image the live page’s sharing metadata currently names. Verify the deployed tags and asset rather than assuming the article cover controls the share preview.

Sources

  1. Next.js: opengraph-image and twitter-imagenextjs.org
  2. Next.js: Metadata and OG imagesnextjs.org
  3. Ranksranks.so

Grow your SaaS traffic on autopilot

One vetted backlink submission and one targeted blog article per day, on autopilot. Track your growth, all in one dashboard.

Try Ranks