When you paste a link into X, Slack or Discord, the preview is built from your raw HTML. The crawler doesn't run your JavaScript. It reads a few meta tags in <head>, and if they're missing you get a grey box with a domain name.
Last week I scanned brand-new GitHub projects for this. This week I pointed the same check at the 30 newest Show HN launches (Dec 4), and re-checked last week's broken homepages to see if anything changed.
The 30 newest Show HN links
Fetched once each, raw HTML only (no JS, like a link crawler), then the og:image downloaded to confirm it actually loads.
| Result | Sites |
|---|---|
Big image card (og:image + twitter:card=summary_large_image, image loads) | 18 |
Image, but no twitter:card → X falls back to a small thumbnail | 3 |
No og:image → no picture at all | 8 |
| Fetch blocked / failed | 1 |
So 11 of the 29 readable launches leave their share card to chance, on the one day they're most likely to be shared.
The 8 "no image" cases aren't all the same mistake:
- 3 sites have zero OG tags. No title, no description, no image. The page is probably fine in a browser; the head just has a
<title>and nothing else. - 4 sites did most of the work.
og:titleis there (plusog:descriptionon 3 of them),twitter:cardis set tosummary, but no image tag. - 1 site asks for a large card and gives it nothing to show.
twitter:card=summary_large_imagewith noog:imageortwitter:image.
The 3 "small thumbnail" sites are the opposite: they have a good image, but without twitter:card X picks the small layout. That's one missing line.
Last week's broken homepages, 6 days later
Last week I flagged 17 project homepages (linked from new GitHub repos) with missing or broken cards. I re-fetched all 17 today with a Twitterbot user agent, raw HTML, same as last time.
- 2 fixed. Both now serve a 1200×630
og:imagewithsummary_large_image. - 14 unchanged.
- 1 got worse. The root page now does a
<meta http-equiv="refresh">to a language subfolder. A meta refresh is not an HTTP redirect, so link crawlers read the root page itself, and that page has no OG tags. It went from a small thumbnail to a blank card.
2 out of 17 in a week. Nobody gets an error when a card is missing. You only find out when someone shares your link and it looks dead.
The fix
If you control the HTML, this is the whole thing:
<meta property="og:title" content="Your project in one line"> <meta property="og:description" content="What it does, for whom"> <meta property="og:image" content="https://example.com/og.png"> <meta name="twitter:card" content="summary_large_image"> Things that tripped up the sites above:
- Use an absolute image URL.
https://..., not/og.png. - The tags must be in the server HTML. If your framework injects them client-side, crawlers never see them. Check with
curl -s https://yoursite | grep -i 'og:'. - Redirect with HTTP (301/302), not meta refresh, if your root forwards to
/en/or similar. Or put the tags on the root too. - 1200×630 PNG or JPG is the safe size. Keep it under a few MB.
-
twitter:carddecides big vs small. Without it you get the small layout even with a great image.
A quick self-check that mimics what X fetches:
curl -s -A "Twitterbot/1.0" https://yoursite \ | grep -ioE '<meta[^>]+(og:|twitter:)[^>]+>' If that prints nothing, your link previews are blank.
Method notes
- Source: the newest 45 Show HN stories from the public HN API; the first 30 that link outside github.com.
- One fetch per site, 20s timeout, raw HTML, no JS. Then the
og:imageURL was fetched to confirm it returns an image. I didn't check image pixel sizes in this batch. - "Blocked" = the fetch itself failed (no HTTP response), so I excluded it from the 29.
- This checks the tags, not how each platform renders them on a given day. Platforms also cache cards, so a fix can take a while to show up on links that were already shared.
If you shipped something this week, run the curl line above before your launch post goes out.
