Guides

How to add a link preview (og:image) — and why Telegram still shows the old one

Illustration: a preview card flying out of a chat window, an empty frame filling with art

You drop a link to your site into a chat — and out comes a bare blue string. Every decent site gets a picture with a headline; yours gets nothing.

Four lines in <head> fix it. But there's a catch: even after you've done everything right, Telegram stubbornly keeps showing the old version — and that's where half the people decide it didn't work. Let's handle both.

What actually happens when you send a link

The messenger doesn't open your page like a human would. It visits with a robot, reads only the <head>, and looks for special tags — Open Graph. Found them: it builds a card. Didn't: it shows whatever it can, or nothing.

So the preview image isn't chosen by you at the moment of sending — it's chosen in advance by your page. There's a separate walkthrough on the rest of the <head>; this one is only about previews.

Step by step: from image to card

1. Make an image 1200 × 630. That's a 1.91:1 ratio, and every platform digests it. Keep the type big: in a chat feed the card is thumbnail-sized, so a logo and three or four words is the maximum. PNG or JPG, and keep the file under a megabyte — the robot won't wait long.

2. Put it at a permanent address. Something like https://yoursite.com/og.png. Open that address in a private window — if you can see the image there, so can the robot.

3. Add the tags to <head>.

<meta property="og:title" content="Page title" />
<meta property="og:description" content="One sentence about what's inside" />
<meta property="og:image" content="https://yoursite.com/og.png" />
<meta property="og:url" content="https://yoursite.com/" />
<meta name="twitter:card" content="summary_large_image" />

That last line is for X (Twitter): without it you get a small card off to the side instead of the big picture.

4. Make sure the image URL is absolute. This is mistake number one. /og.png works beautifully in your browser, but the robot arrives from outside and has no idea what to measure that path from. It needs the full address, scheme and domain included. More on what an address is made of in a separate piece.

5. Look at the page through the robot's eyes. Don't guess — check what the server actually returns:

curl -s https://yoursite.com | grep -i "og:"

If the console is empty but the tags are "there" on the page, JavaScript is adding them in the browser. The robot doesn't run scripts: it gets an empty <head> and leaves with nothing. The tags have to be in the server's response.

6. Clear the preview cache. This is the step everything usually gets stuck on. Messengers remember a card for a long time and will keep showing the old or empty one after your edits:

  • Telegram — message the @WebpageBot bot and send it your link; it refreshes the preview;
  • social platforms — most have their own link validators, which also bust the cache when you check;
  • the universal trick — add a version to the image address: og.png?v=2. To the robot that's a new file with no cache behind it.

7. Test in a real chat. Send the link to yourself, to Saved Messages. Actually send it: if you paste and immediately edit the message, the preview may not rebuild.

Three rakes almost everyone steps on

  • Testing on localhost. The messenger's robot lives on the internet and will never reach your laptop. Previews can only be tested on a published site.
  • The page is closed. A password on the staging version, bot blocking, a "coming soon" wall — the robot sees what a logged-out stranger sees. Nothing seen, no card.
  • Links with redirects. Short links and www redirects sometimes drop the tags on the way. Test the exact address you're actually sharing.

What you end up with

Your link unfurls in chat as a card: image, headline, one line of description. People click those noticeably more often than a bare string — and it cost you fifteen minutes, once.

There's room to grow from here: give each page its own image (an article gets its cover, a product gets its photo). The rule is identical, only the og:image value changes. And once you have a lot of pages, the image gets drawn on the fly from the page title, right on the server. That's the next step, though — start with one shared picture.

If you're building a landing page, add this to your pre-launch checklist — previews are usually remembered right after the link has been sent out.

Why does Telegram still show the old image?

It cached the preview the first time the link was sent. Send the link to @WebpageBot, or change the image address (?v=2) so it counts as new.

Do I need separate tags for X (Twitter)?

Usually the og tags are enough — X understands them. The only one worth adding is twitter:card set to summary_large_image, otherwise the card comes out small.

I'm on React or Next.js — where do the tags go?

Wherever <head> is built on the server (in Next.js that's metadata or <head> in the layout). What matters is that the tags arrive in the initial HTML rather than being painted in by a script.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →