codeshah
ServicesToolsBlogAboutContact
Write to me
codeshah

Independent full-stack developer building web and mobile apps, AI tools and automations for teams that care about quality.

Explore

  • Services
  • Tools
  • Blog
  • About
  • Contact
  • Support my work

Get in touch

[email protected]

Working worldwide · IST (UTC+5:30)

Client login

© 2026 Shahbaz Ansari. All rights reserved.

PrivacyDesigned and built by me.

All posts

client guide, link previews

Why your link preview looks wrong on WhatsApp, LinkedIn or X

How link previews are built, why they show the wrong image or none at all, and how to fix and refresh them across the main apps.

Shahbaz Ansari3 min readAlso available in日本語한국어DeutschEspañolFrançaisPortuguês

You share your new page and the preview shows an old title, a cropped logo or a grey box. People judge a link by that card before they click, so a broken preview costs visits on every share.

Previews follow a few simple rules. Once the page gives the apps what they look for, the problem usually stays fixed.

Where the preview comes from

When someone pastes a link, the app’s crawler fetches your page and reads a handful of tags in its HTML head. The main standard is the Open Graph protocol, which defines og:title, og:type, og:image and og:url. Most apps also read og:description, and X reads its own twitter:card tags, falling back to Open Graph for the rest.

The crawler does not scroll, click or wait the way a person does. It reads what the server sends first. Anything added later by JavaScript is often invisible to it.

Why it goes wrong

  • The tags are missing, so the app guesses from whatever text and images it finds.

  • The tags are added by JavaScript after the page loads, so the crawler never sees them.

  • og:image uses a relative path or an http address instead of a full https URL.

  • The image is too large, too small, the wrong shape or blocked by a firewall, bot protection or a login.

  • Every page shares the same generic title and image, so each link looks identical.

  • The app cached an old version of the page and keeps showing it.

An image that works everywhere

Use a landscape image of 1200 × 630 pixels, saved as JPEG or PNG and kept reasonably small. Keep important text and logos away from the edges, because some apps crop to a square or a narrower shape. Serve it from a full https URL that anyone can open without signing in.

Add og:image:width, og:image:height and og:image:alt as well. They help apps lay out the card before the image downloads and describe the image to people using screen readers.

Refreshing a cached preview

Apps store previews, sometimes for days. After fixing the tags you may need to ask them to read the page again. Facebook’s Sharing Debugger and LinkedIn’s Post Inspector both have a button to fetch a URL again. For other apps, sharing the link with a harmless query string, such as ?v=2, creates a fresh preview.

Test before you share

My free link preview tester fetches your page the way preview crawlers do, reads the Open Graph and X card tags, downloads the images to check they load and measures their size and weight. It then shows how the card is likely to look on X, LinkedIn, Facebook, WhatsApp, Slack and Discord, with a list of fixes.

Each app has its own rules and changes them from time to time, so treat the previews as a close guide rather than a pixel-perfect copy.

Make it automatic

On a site with many pages, previews should come from the content itself: the product name, article title or event date, with an image generated or chosen for each page. Frameworks such as Next.js can produce these tags and images on the server. If your pages share one generic card, tell me about the site and I can set that up so every new page gets a proper preview without extra work.

On this page

  • Where the preview comes from
  • Why it goes wrong
  • An image that works everywhere
  • Refreshing a cached preview
  • Test before you share
  • Make it automatic
Share

Need help with something like this?

Shahbaz Ansari · codeshah

Let's talk

More posts

3 min read

Core Web Vitals explained for business owners

What LCP, INP and CLS measure, why your real visitors’ data matters more than a speed score, and how to tell whether your site is getting faster or slower.

client guide, site speed

4 min read

Why your business emails land in spam, and how to fix it

SPF, DKIM and DMARC explained without jargon: what each record does, the mistakes that send invoices and password resets to spam, and how to check your domain.

client guide, email delivery