DEV Community

Your blog's link preview is probably broken - here's a 1-line CI check

The silent bug that quietly kills your click-through

You add <meta property="og:image" content="...">, the preview looks fine when you test it, you ship. Weeks later the image gets moved, the CDN path changes, or it was a relative URL all along - and now every share is a blank card. Your click-through quietly drops and nothing alerts you.

Catch it in one request (or in CI)

I built OGCheck to catch exactly this. It parses your Open Graph + Twitter Card tags, scores them, and - the key part most validators skip - actually requests the og:image to confirm it returns HTTP 200.

python -m ogcheck https://your-site.com/blog/post
# exits non-zero if og:image 404s or required tags are missing -> perfect for CI

There's a JSON API and a GitHub Action too:

- uses: rahulatrkm/ogcheck@v1
  with:
    url: https://your-site.com

The 5 things that actually break previews

  • The image URL 404s (most common)
  • A relative URL instead of an absolute one
  • A cached old preview on the platform (re-scrape to bust it)
  • Wrong dimensions or file type (use PNG/JPG at 1200ร—630)
  • Crawlers blocked by robots.txt or auth

It's a small "site health" suite now

Same free API also checks the other things that silently break how your site shows up:

  • GET /check?url=โ€ฆ - social preview (Open Graph + og:image loads)
  • GET /robots?url=โ€ฆ - robots.txt (catches an accidental site-wide Disallow: /)
  • GET /sitemap?url=โ€ฆ - sitemap.xml (valid XML, reachable, lists URLs)

It's free, zero-dependency (pure Python stdlib), and open source: https://github.com/rahulatrkm/ogcheck

If you monitor a lot of pages, I'm thinking about a paid "watch these URLs and alert me when a preview breaks" tier - would that be useful? Honest feedback very welcome, especially on false positives.

Comments

No comments yet. Start the discussion.