Explainers

Open Graph Protocol: The Definitive Guide to Link Previews

Turns out, that little preview box when you paste a link somewhere? It's not magic. It's Open Graph. And it's been around for a decade, largely unchanged.

Diagram showing meta tags in an HTML head section related to Open Graph properties.

Key Takeaways

  • The Open Graph protocol, established by Facebook in 2010, dictates how URLs appear in link previews across social media and messaging apps.
  • Four core properties (`og:title`, `og:type`, `og:image`, `og:url`) are essential, with three recommended (`og:description`, `og:site_name`, `og:locale`) for optimal sharing.
  • Image specifications (`og:image`) require specific dimensions (1200x630 standard) and associated properties for quality and accessibility.
  • Twitter Cards fallback to Open Graph tags when their own are absent, making Open Graph a foundational element for cross-platform sharing.
  • Tools like Facebook's Sharing Debugger are critical for diagnosing and fixing broken link previews, often caused by caching issues or incorrect tag implementation.

And suddenly, you’re staring at a broken image. Or worse, just the URL itself. A crime against digital aesthetics. This happens when the Open Graph protocol fails. Or, more accurately, when you fail to implement it correctly. And let’s be honest, most people do.

This isn’t some hot new JavaScript framework promising to change your life. This is Open Graph. A metadata system. Older than most of your favorite CSS libraries. Facebook dumped it on us in 2010. And it’s still the silent architect of how your meticulously crafted content looks when shared across Facebook, LinkedIn, Slack, iMessage, you name it.

It’s the invisible hand guiding the little image, the snappy title, the pithy description that pops up. It’s the reason your blog post doesn’t look like a dumpster fire when shared. Or why it does.

Why Does This Still Matter?

Because people still share links. Shocking, I know. In this age of doomscrolling and fleeting attention spans, a good link preview is the difference between a click and oblivion. It’s your digital handshake. Your first impression. Get it wrong, and you might as well be shouting into the void.

And the standard? It’s practically ancient. ogp.me hasn’t budged since 2014. The core has been stable for a decade. The platforms have changed. Their caching, their rendering, their interpretation. But the fundamental rules? Still the same.

So, what actually is this thing? It’s a set of meta tags. You slip them into the <head> of your HTML. They tell the world what your page is about, how it should be displayed. Think of it as a self-description for social media bots.

The Bare Bones: What You Absolutely Need

Forget all the fancy bells and whistles for a minute. There are four required properties. Mess these up, and you’re already losing. og:title is obvious. Your page’s title. og:type. Is it an article? A website? A video? og:image. The visual hook. And og:url. The canonical link. No excuses.

Then there are three recommended ones. Don’t skip these. og:description. A summary. Make it compelling. og:site_name. The name of your site. And og:locale. The language. It sounds basic, but getting this right is surprisingly rare.

The protocol uses the RDFa property= attribute instead of the standard HTML name= attribute, with the og: namespace prefix.

This is where some developers get lost. They use name when they should be using property. Small detail, big consequences. The crawler sees `name=


🧬 Related Insights

Written by
DevTools Feed Editorial Team

Curated insights, explainers, and analysis from the editorial team.

Worth sharing?

Get the best Developer Tools stories of the week in your inbox — no noise, no spam.

Originally reported by dev.to

Stay in the loop

The week's most important stories from DevTools Feed, delivered once a week.