The Definitive Guide to Open Graph in 2025
Open Graph (OG) tags control how your links appear on social platforms and messaging apps. Done right, they boost click-through, shareability, and trust. This guide covers what actually matters in 2025: the essential tags, safe image specs, platform quirks (X/Twitter, Facebook, LinkedIn, Slack/Discord, iMessage/WhatsApp), cache refresh tactics, and how to make previews dynamic with a single API call.
TL;DR (use this checklist)
- Always set:
og:title
,og:description
,og:image
,og:url
. - Image: 1200×630 (1.91:1) JPG or PNG. Keep under ~1–2 MB; include
og:image:alt
. - Twitter/X: add
name="twitter:card" content="summary_large_image"
(safe default). - Canonical: set
<link rel="canonical" href="..."/>
to a single, stable URL. - Caching: platforms cache aggressively. When you change a preview, bust the image URL (e.g.,
?v=2
) and re-share. - Dynamic: generate OG images per campaign/user and attach via your short link (ogli.sh makes this easy).
How Open Graph works
When someone shares a URL, platforms fetch the page HTML and read meta tags in the
<head>
. They use those tags to render the preview card (image, title,
description). Many platforms also cache the result for speed and abuse prevention.
<!-- Minimum viable OG setup -->
<meta property="og:title" content="My Page Title" />
<meta property="og:description" content="Short, compelling summary (100–160 chars)." />
<meta property="og:url" content="https://example.com/my-page" />
<meta property="og:image" content="https://cdn.example.com/og/my-page-1200x630.jpg" />
<meta property="og:image:alt" content="Descriptive text for screen readers and fallbacks" />
<!-- Twitter/X safe default -->
<meta name="twitter:card" content="summary_large_image" />
Image specs that “just work”
- Size: 1200×630 px is a reliable cross-platform choice. If you must pick one aspect ratio, use ~1.91:1.
- Format: JPG (quality ~75–85) for photos; PNG for text/graphics; avoid huge files.
- Safe framing: keep essential text/logos inside a generous margin—platforms may crop on smaller screens.
- Multiple images: OG supports multiple
og:image
tags; most platforms just take the first. - Accessibility: set
og:image:alt
(andtwitter:image:alt
if you add Twitter-specific metas).
Platform quirks (what to expect)
- X / Twitter: honors basic OG;
twitter:card
can improve consistency. Cropping can vary on mobile; avoid tiny text on the image. - Facebook & Instagram DMs / Messenger: reads OG; caches hard. Use an image version param when changing previews.
- LinkedIn: prefers 1.91:1; can truncate long descriptions; caches previews per URL.
- Slack / Discord: render link unfurls using OG; they’re sensitive to HTTPS/headers. Make sure the image is publicly fetchable.
- iMessage / iOS preview / WhatsApp: honor OG basics; smaller layouts show less description, so front-load the value.
Caching & refresh strategy
Most platforms won’t refetch your page immediately if you tweak a title or image. Practical ways to see updated previews:
- Version your image URLs (e.g.,
og:image=https://cdn.example.com/og/card.jpg?v=2
). - Use a stable page URL (
og:url
matches canonical), but swap the image URL and re-share. - Mind headers: serve images with long-lived cache on your CDN, but change the querystring when you update.
- Debug locally: paste the URL in multiple platforms or use their inspectors to see what they fetched last.
Dynamic OG: personalize & A/B test
Static previews are fine, but dynamic previews convert better: add campaign names, prices, deadlines, or user names to the image at share time. You can also A/B test creative variants.
With a short link in front of your destination, you can attach different OG metadata per campaign without touching the destination page. That’s exactly what ogli.sh is for.
Example: dynamic preview via ogli.sh
Create a short link that points to your real URL, but overrides the preview:
# cURL example (adjust fields to your API)
curl -X POST https://api.ogli.sh/v1/links \
-H "Authorization: Bearer $OGLI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/product/123",
"alias": "launch-123",
"og": {
"title": "New: SuperWidget 2.0",
"description": "Ships today. Free returns. See what’s new.",
"image": "https://cdn.example.com/og/superwidget-1200x630.jpg?v=launch"
},
"qr": { "enabled": true },
"expiresAt": null,
"webhookUrl": "https://hooks.example.com/ogli-events"
}'
Now share https://ogli.sh/launch-123
. The card will use your custom OG, even if the destination page has different tags.
Rotate creatives without breaking links
Want to update the preview after launch day? Keep the short link, just switch the OG image:
# Update the OG image later (example)
curl -X PATCH https://api.ogli.sh/v1/links/launch-123 \
-H "Authorization: Bearer $OGLI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"og": {
"image": "https://cdn.example.com/og/superwidget-1200x630.jpg?v=day2"
}
}'
Copy & design tips that lift CTR
- Title: front-load the value. Treat it like an email subject line (no clickbait, promise a clear outcome).
- Description: aim for ~120–160 chars; add one concrete detail (price, date, or differentiator).
- Image: simple composition, big type, strong focal element, generous margins, clear brand.
- Consistency: make image text match the title; mixed messages kill trust.
- Localization: if you localize previews, ensure the short link routes to matching language content.
Quality assurance: a 2-minute pre-flight
- View page source and confirm the tags in
<head>
(no duplicates, no typos). - Hit the image URL directly—loads fast? correct size? HTTPS? correct cache headers?
- Share the link in a private channel (Slack/Discord/DM) and confirm the card looks right.
- Test on mobile—does the image crop hide critical text?
- If you change the preview, bump the image querystring and re-share.
FAQ
Do I need both OG and Twitter tags?
OG is the baseline. Adding twitter:card
ensures consistent large-image cards on X/Twitter.
What if my destination page already has OG tags?
Your short link can override them. That’s useful when you want campaign-specific previews without editing the destination site.
Can I use multiple images?
You can include multiple og:image
tags, but many platforms use only the first. Pick the best one and keep it simple.
How big can the image be?
Keep it under ~1–2 MB for quick fetches; huge images risk timeouts or compression artefacts.
Recap & next steps
- Ship the four core tags and a 1200×630 image with alt text.
- Expect caching—version your image when you update.
- Use short links to decouple previews from your destination page.
- Personalize and A/B test previews for meaningful CTR gains.
Try it now: create a short link with a custom preview, share it on your socials, and watch the difference. When you’re ready to scale, wire in webhooks and rotate creatives per campaign.