HTML5 Mastery: The Complete Web Foundation
HomeInsightsCoursesHTMLOpen Graph & Social Media Meta Tags
SEO & Discovery

Open Graph & Social Media Meta Tags

Control how your content appears when shared on social media. Learn Open Graph, Twitter Cards, and other social meta tags for beautiful, engaging social shares.

Why Social Meta Tags Matter

When someone shares your link on Facebook, Twitter, LinkedIn, or other platforms, social meta tags control the title, description, image, and other display elements.

📈 Higher CTR

Rich previews get 3-5x more clicks

🎨 Brand Control

Control how your brand appears

🔗 More Shares

Attractive previews encourage sharing

📊 Better Tracking

Track social media traffic sources

Open Graph Protocol (Facebook, LinkedIn)

Open Graph was created by Facebook and is now used by most social platforms including LinkedIn, Pinterest, and Slack.

Basic Open Graph Tags

HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Essential Open Graph tags --&gt;
    <meta property="og:title" content="Free Image Compressor - Reduce JPG, PNG Size">
    <meta property="og:description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality. Fast, secure, no registration.">
    <meta property="og:image" content="https://www.filefusion.app/images/og-image-compressor.jpg">
    <meta property="og:url" content="https://www.filefusion.app/tools/image-compressor">
    <meta property="og:type" content="website">
    
    <!-- Optional but recommended --&gt;
    <meta property="og:site_name" content="FileFusion">
    <meta property="og:locale" content="en_US">
</head>
<body>
    <!-- Content --&gt;
</body>
</html>

Open Graph Tag Reference

TagDescriptionRequired
og:titleTitle of your content (60-90 chars)✅ Yes
og:descriptionDescription (155-200 chars)✅ Yes
og:imageImage URL (1200x630px optimal)✅ Yes
og:urlCanonical URL of page✅ Yes
og:typeContent type (website, article, etc.)✅ Yes
og:site_nameName of websiteRecommended
og:localeLanguage/locale (en_US, es_ES)Optional

Open Graph Image Best Practices

HTML
<!-- Optimal image specifications --&gt;
<meta property="og:image" content="https://www.filefusion.app/images/og-image.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="FileFusion - Free Online File Tools">
<meta property="og:image:type" content="image/jpeg">

<!-- Multiple images (platforms pick best) --&gt;
<meta property="og:image" content="https://www.filefusion.app/images/og-large.jpg">
<meta property="og:image" content="https://www.filefusion.app/images/og-square.jpg">

Image Requirements:

  • 📐 Size: 1200x630px (1.91:1 ratio) recommended
  • 📏 Minimum: 600x315px
  • 📦 File size: Less than 8MB
  • 🎨 Format: JPG or PNG (no transparency on Facebook)
  • 📱 Safe zone: Keep important elements in center 1:1 square
  • 📝 Text: Minimal text (20% rule no longer enforced but recommended)
  • 🔒 HTTPS: Must be served over HTTPS

Twitter Cards

Twitter uses its own meta tags but falls back to Open Graph if Twitter tags aren't present.

Summary Card with Large Image

HTML
<head>
    <!-- Twitter Card tags --&gt;
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@filefusion">
    <meta name="twitter:creator" content="@johndoe">
    <meta name="twitter:title" content="Free Image Compressor - Reduce JPG, PNG Size">
    <meta name="twitter:description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality.">
    <meta name="twitter:image" content="https://www.filefusion.app/images/twitter-card.jpg">
    <meta name="twitter:image:alt" content="Image compression comparison showing before and after">
    
    <!-- Open Graph (Twitter uses as fallback) --&gt;
    <meta property="og:title" content="Free Image Compressor - Reduce JPG, PNG Size">
    <meta property="og:description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality.">
    <meta property="og:image" content="https://www.filefusion.app/images/og-image.jpg">
    <meta property="og:url" content="https://www.filefusion.app/tools/image-compressor">
</head>

Twitter Card Types

  • summary: Small image (1:1 ratio, 144x144px min)
  • summary_large_image: Large image (2:1 ratio, 300x157px min, 4096x4096px max)
  • app: Mobile app download
  • player: Video/audio player

Article-Specific Tags

For Blog Posts and Tutorials

HTML
<head>
    <!-- Article type --&gt;
    <meta property="og:type" content="article">
    
    <!-- Article metadata --&gt;
    <meta property="article:published_time" content="2024-01-15T08:00:00+00:00">
    <meta property="article:modified_time" content="2024-01-20T10:30:00+00:00">
    <meta property="article:author" content="https://www.filefusion.app/authors/jane-smith">
    <meta property="article:section" content="Tutorials">
    <meta property="article:tag" content="Image Compression">
    <meta property="article:tag" content="Web Performance">
    <meta property="article:tag" content="SEO">
    
    <!-- Publisher info --&gt;
    <meta property="og:site_name" content="FileFusion">
    
    <!-- Author social profiles --&gt;
    <meta name="twitter:creator" content="@janesmith">
</head>

Video Meta Tags

HTML
<head>
    <!-- Video type --&gt;
    <meta property="og:type" content="video.other">
    
    <!-- Video URL --&gt;
    <meta property="og:video" content="https://www.filefusion.app/videos/tutorial.mp4">
    <meta property="og:video:secure_url" content="https://www.filefusion.app/videos/tutorial.mp4">
    <meta property="og:video:type" content="video/mp4">
    <meta property="og:video:width" content="1920">
    <meta property="og:video:height" content="1080">
    
    <!-- Video thumbnail --&gt;
    <meta property="og:image" content="https://www.filefusion.app/videos/thumbnail.jpg">
    
    <!-- Twitter player card --&gt;
    <meta name="twitter:card" content="player">
    <meta name="twitter:player" content="https://www.filefusion.app/videos/player.html">
    <meta name="twitter:player:width" content="1280">
    <meta name="twitter:player:height" content="720">
</head>

Complete Social Media Template

HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <!-- Basic SEO --&gt;
    <title>Free Image Compressor - Reduce JPG, PNG Size | FileFusion</title>
    <meta name="description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality. Fast, secure, no registration.">
    <link rel="canonical" href="https://www.filefusion.app/tools/image-compressor">
    
    <!-- Open Graph / Facebook --&gt;
    <meta property="og:type" content="website">
    <meta property="og:url" content="https://www.filefusion.app/tools/image-compressor">
    <meta property="og:title" content="Free Image Compressor - Reduce JPG, PNG Size">
    <meta property="og:description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality. Fast, secure, no registration.">
    <meta property="og:image" content="https://www.filefusion.app/images/og-compressor.jpg">
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="630">
    <meta property="og:image:alt" content="FileFusion Image Compressor Tool">
    <meta property="og:site_name" content="FileFusion">
    <meta property="og:locale" content="en_US">
    
    <!-- Twitter --&gt;
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@filefusion">
    <meta name="twitter:creator" content="@filefusion">
    <meta name="twitter:title" content="Free Image Compressor - Reduce JPG, PNG Size">
    <meta name="twitter:description" content="Compress images online for free. Reduce file sizes by up to 80% without losing quality.">
    <meta name="twitter:image" content="https://www.filefusion.app/images/twitter-compressor.jpg">
    <meta name="twitter:image:alt" content="Image compression tool interface">
    
    <!-- Additional platforms --&gt;
    <meta property="fb:app_id" content="your-facebook-app-id">
    <meta name="pinterest-rich-pin" content="true">
    
    <!-- Favicon --&gt;
    <link rel="icon" type="image/png" href="/favicon.png">
    <link rel="apple-touch-icon" href="/apple-touch-icon.png">
</head>
<body>
    <!-- Content --&gt;
</body>
</html>

Platform-Specific Considerations

Facebook

  • 📐 Image: 1200x630px optimal
  • 🔄 Cache: Facebook caches for 7 days (use Sharing Debugger to refresh)
  • 📱 App ID: Add fb:app_id for Facebook Insights
  • ✂️ Text: Keep title under 60 characters, description under 200

Twitter

  • 📐 Large image: 2:1 ratio (800x418px min)
  • 📐 Summary: 1:1 ratio (144x144px min)
  • 🏷️ Username: Use @username format
  • ✂️ Text: Title 70 chars max, description 200 chars max

LinkedIn

  • 📐 Image: 1200x627px optimal
  • 📝 Uses Open Graph tags
  • ✂️ Title: 150 characters max
  • ✂️ Description: 256 characters max

Pinterest

  • 📐 Image: 1000x1500px optimal (2:3 ratio)
  • 📌 Vertical images perform best
  • 🔖 Add meta name="pinterest-rich-pin"

WhatsApp

  • 📱 Uses Open Graph tags
  • 📐 Image: 300x300px min
  • 🔗 Shows title, description, and thumbnail

Testing Social Meta Tags

Testing Tools

  • Facebook Sharing Debugger:
    https://developers.facebook.com/tools/debug/
    Test and refresh Facebook cache
  • Twitter Card Validator:
    https://cards-dev.twitter.com/validator
    Preview Twitter cards
  • LinkedIn Post Inspector:
    https://www.linkedin.com/post-inspector/
    Test LinkedIn previews
  • Open Graph Checker:
    https://www.opengraph.xyz/
    Test multiple platforms at once

Common Mistakes

❌ Mistake 1: Using Relative URLs

HTML
<!-- ❌ Wrong --&gt;
<meta property="og:image" content="/images/og-image.jpg">

<!-- ✅ Correct --&gt;
<meta property="og:image" content="https://www.filefusion.app/images/og-image.jpg">

❌ Mistake 2: Wrong Image Size

HTML
<!-- ❌ Too small (will be blurry) --&gt;
<meta property="og:image" content="...logo-200x200.png">

<!-- ✅ Optimal size --&gt;
<meta property="og:image" content="...og-image-1200x630.jpg">

❌ Mistake 3: No Image Alt Text

HTML
<!-- ❌ Missing alt --&gt;
<meta property="og:image" content="...image.jpg">

<!-- ✅ With alt text --&gt;
<meta property="og:image" content="...image.jpg">
<meta property="og:image:alt" content="Description of image">

❌ Mistake 4: Same Tags for All Pages

HTML
<!-- ❌ Generic title for all pages --&gt;
<meta property="og:title" content="FileFusion">

<!-- ✅ Page-specific title --&gt;
<meta property="og:title" content="Image Compressor - FileFusion">

❌ Mistake 5: Not Testing

Always test your social tags before sharing!

Best Practices Checklist

  • ☑ Use absolute URLs (not relative)
  • ☑ Optimize images (1200x630px for Facebook/LinkedIn)
  • ☑ Include Twitter Card tags
  • ☑ Add image alt text (og:image:alt)
  • ☑ Keep titles under 60 characters
  • ☑ Keep descriptions under 200 characters
  • ☑ Use HTTPS for all URLs
  • ☑ Unique tags for each page
  • ☑ Test with platform-specific tools
  • ☑ Include og:type (website, article, etc.)
  • ☑ Add fb:app_id for Facebook Insights
  • ☑ Use meaningful, descriptive text

What's Next?

Learn about HTML5 APIs like Geolocation, Web Storage, and Drag & Drop.