← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Open Graph Protocol

frontend Beginner

Also Known As

OG tags opengraph og meta tags social meta tags facebook meta tags social sharing tags

TL;DR

Meta tags that control how a page appears when shared on social platforms — title, description, image, and URL shown in link previews on Facebook, LinkedIn, Slack, Discord, and Twitter/X.

Explanation

Open Graph (OG) was introduced by Facebook in 2010 and has since become the universal standard for social sharing metadata, adopted by all major platforms. The four required tags are og:title, og:description, og:image, and og:type. Twitter/X reads OG tags as fallback for its own twitter:card tags. When a URL is shared in Slack, Discord, WhatsApp, LinkedIn, or Facebook, the platform's crawler fetches the page and reads OG tags to build the link preview. Without them, platforms show the page URL with no image and often wrong or empty title/description. og:image has strict requirements: must be an absolute URL (https://), recommended minimum 1200×630px for optimal display, and the server must allow the crawler's User-Agent. Dynamic OG image generation (via serverless functions or edge workers) enables per-page preview images at scale.

Common Misconception

Open Graph tags only matter for Facebook — every major platform (LinkedIn, Twitter/X, Slack, Discord, WhatsApp, iMessage) reads OG tags to generate link previews; skipping them produces broken or empty previews everywhere.

Why It Matters

A page shared on LinkedIn or Slack without og:image shows a text-only link that blends into surrounding content — pages with a compelling OG image get significantly higher click-through rates on shared links.

Common Mistakes

  • Using a relative URL for og:image — must be absolute (https://domain.com/image.jpg), not /image.jpg.
  • og:image smaller than 600×315px — many platforms will not display undersized images.
  • Same og:image on every page — generic brand image on a product page looks wrong in social previews.
  • og:title duplicating the page title verbatim — social titles can be different and more compelling than SEO titles.
  • Missing og:type — defaults to 'website' but article pages should use og:type='article' for enhanced previews.

Avoid When

  • Do not set og:image to a relative URL — it will not resolve correctly for external crawlers.
  • Do not use og:image dimensions below 600x315px — platforms may ignore undersized images.

When To Use

  • Add OG tags to every page that could be shared on social media or messaging platforms.
  • Use og:type='article' for blog posts and news articles to enable enhanced preview metadata.
  • Use per-page og:image rather than a global brand image for product, article, and landing pages.

Code Examples

✗ Vulnerable
<!-- No OG tags — social platforms generate fallback with no image -->
<head>
  <title>Product Page</title>
</head>
✓ Fixed
<head>
  <meta property="og:title" content="Blue Ceramic Coffee Mug — ShopName">
  <meta property="og:description" content="Handcrafted 350ml mug with bamboo lid. Free shipping on orders over £30.">
  <meta property="og:image" content="https://example.com/images/mug-og.jpg">
  <meta property="og:url" content="https://example.com/products/blue-mug">
  <meta property="og:type" content="product">
  <!-- Twitter/X fallback -->
  <meta name="twitter:card" content="summary_large_image">
</head>

Added 6 Apr 2026
Views 12
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 1 ping T 0 pings F 1 ping S 0 pings S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T
No pings yet today
SEMrush 3 ChatGPT 1 Google 1 Perplexity 1 Ahrefs 1
crawler 7
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Low
⚡ Quick Fix
Add og:title, og:description, og:image (absolute URL, 1200x630px), og:url, and og:type to every page <head>
📦 Applies To
html web
🔍 Detection Hints
Missing <meta property='og:title|og:image|og:description|og:url'> in <head>
Auto-detectable: ✓ Yes lighthouse screaming-frog opengraph.xyz
⚠ Related Problems
🤖 AI Agent
Confidence: High False Positives: Low ✗ Manual fix Fix: Low Context: File

✓ schema.org compliant