Open Graph Tags: How to Control Social Media Previews and Boost SEO

Published: (March 15, 2026 at 12:28 PM EDT)
4 min read
Source: Dev.to

Source: Dev.to

Introduction

Social previews have become the new homepage. When a link is shared on platforms such as LinkedIn, X (Twitter), Facebook, or Slack, Open Graph (OG) tags determine the image, title, and description that users see. Proper implementation of OG tags ensures consistent previews, higher click‑through rates, and can reinforce SEO signals.

Basic Open Graph Tags

Add the following meta tags inside the <head> of every shareable page:

Optional tags for brand consistency

Best Practices

Titles & Descriptions

  • Length: Keep titles under ~60 characters and front‑load primary keywords.
  • Description: Aim for 140–180 characters, clearly stating the benefit.
  • Avoid quotes and unusual punctuation that some clients truncate.
  • Ensure the OG title/description match the on‑page content to avoid clickbait and improve relevance signals.

Image Guidelines

  • Recommended size: 1200 × 630 px (aspect ratio 1.91:1) in JPG or PNG, under ~2 MB.
  • Minimum size: 200 × 200 px; smaller images may be ignored.
  • Include the product name, a short headline, and the brand mark; avoid tiny text.
  • Use high contrast so the image looks good on both light and dark backgrounds.
  • Host OG images on a CDN for fast, cacheable delivery.

URL & Canonicalization

  • og:url must point to the canonical URL for each language/version.
  • Use <link rel="canonical"> to tell crawlers the primary URL, preventing split engagement metrics when the same content exists under tracking parameters or regional domains.
  • Always use absolute HTTPS URLs in OG tags (no relative URLs).

Localization

  • Set og:locale (e.g., en_US, de_DE) and og:locale:alternate for alternate language versions.
  • Localize titles, descriptions, and images for multilingual pages.
  • Keep each preview language‑consistent; avoid mixing languages in a single preview.

Testing & Debugging

ToolPurpose
Facebook Sharing DebuggerShows how Facebook reads your OG tags; lets you force a re‑scrape.
LinkedIn Post InspectorSimilar to Facebook’s tool for LinkedIn.
Twitter Card ValidatorChecks Twitter‑specific tags (twitter:card, twitter:image).
Open Graph Preview (e.g., https://opengraph-preview.com)Renders a preview of your tags before publishing.

Workflow

  1. Add/modify OG tags.
  2. Run the URL through the appropriate debugger to verify fields, aspect ratios, and image accessibility.
  3. If changes were made, use the tool’s “Scrape Again” or “Refresh” button to clear cached previews.

Common Issues & How to Fix Them

IssueCauseFix
Missing or broken imageog:image absent, relative URL, or image blocked by robots.txt/authenticationAdd an absolute HTTPS URL; ensure the image is publicly accessible.
Image too smallDimensions < 200 × 200 pxUse the recommended 1200 × 630 px size.
Stale preview after redesignPlatform cache still holds old imageRe‑scrape the URL via the debugger or add a cache‑busting query string to the image URL.
Same OG image for every pageReusing a generic imageGenerate unique OG images per page (e.g., from a template that injects the page title).
Mixed language contentTitles/descriptions not localizedProvide separate OG tags for each language version and set og:locale accordingly.

Updating OG Tags

  • When to update: Whenever you change page titles, descriptions, main content, or visual branding.
  • After updates: Re‑scrape the URL with the platform’s debugger to purge cached data.
  • Remember that Twitter falls back to og:image if twitter:image is missing, but providing both maximizes compatibility.

Conclusion

Open Graph tags are a powerful way to control how your content appears on social media, influencing click‑through rates and reinforcing SEO. By implementing the core tags, following image and localization best practices, and regularly testing with platform debuggers, you can ensure every shared link looks intentional and drives engagement.

0 views
Back to Blog

Related posts

Read more »

HTML/CSS Blank

This is a blank template for a simple web page. There is no layout, just the barebones structure of a page to get started....