Documentation & Technical SEO

Open Graph & Social Card Engineering for Developer Publications

When your article is shared in Slack, Discord, X, or Hacker News, your OG image and meta tags decide whether engineers click or scroll past.

Developer links travel privately before they ever trend publicly. An engineer drops your guide into a company Slack channel or a Discord thread, and the messaging client immediately unfurls your Open Graph (OG) title, description, and preview card.

If your unfurl shows a broken image, a truncated headline, or generic homepage boilerplate, your click-through rate inside private team chats drops sharply. Worse, once a broken card is cached by a messaging platform, thousands of subsequent shares inherit that stale preview.

1. The Essential Open Graph & Twitter Tag Set

Every article, doc page, and landing page should emit absolute HTTPS URLs for both og:url and og:image. Relative paths like /images/og.png fail silently in several unfurlers, and HTTP redirects on image URLs can trigger timeouts:

<meta property="og:type" content="article">
<meta property="og:site_name" content="marketings.dev">
<meta property="og:title" content="Documentation SEO for DevTools">
<meta property="og:description" content="Turn technical docs into your #1 organic channel.">
<meta property="og:url" content="https://marketings.dev/articles/documentation-seo">
<meta property="og:image" content="https://marketings.dev/og/documentation-seo.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Documentation SEO for DevTools article card">
<meta name="twitter:card" content="summary_large_image">

2. Design Rules for Technical Preview Cards

  • Dimensions: Use 1200 × 630 px (1.91:1 aspect ratio) in PNG or JPEG format—avoid SVG or WebP for og:image, as Slack and older unfurl bots frequently reject them.
  • Typography first: Put the article title in large, high-contrast type (at least 48px) with a small category badge and domain mark—skip busy stock photos.
  • Keep titles under 60 characters: Longer headlines get cut off with ellipses on mobile Slack and Discord previews.
  • Safe margins: Keep text at least 64px away from all four edges so rounded corners and mobile crops never slice off characters.

3. Platform-Specific Unfurl Quirks

Platform Crawler Behavior Engineering Guardrail
Slack Fetches HTML with a strict timeout (~3–5s) Serve static HTML and pre-generated PNGs from a CDN edge
Discord Respects theme-color meta tag for embed stripe Add <meta name="theme-color" content="#0f172a">
X (Twitter) Falls back to og:* if twitter:title is omitted Always include twitter:card="summary_large_image"
LinkedIn Requires og:image:width & height for instant render Declare explicit dimensions and keep file size under 5 MB

4. Automate Build-Time OG Image Generation

Do not hand-export PNGs in Figma for every blog post. Generate them deterministically during your static build using an HTML-to-SVG-to-PNG pipeline (such as Satori + Resvg) driven directly by each article's frontmatter title, category, and author. That guarantees zero missing cards and consistent typography across 100+ guides.

Make sure your build script also verifies that every generated PNG exists on disk and weighs under 500 KB—oversized uncompressed PNGs slow down mobile chat previews on cellular connections. If you run a WAF or bot-protection rule in front of your site, explicitly allow requests from Slackbot-LinkExpanding, Twitterbot, Discordbot, and LinkedInBot so security challenges never block social card rendering.

5. Pre-Publish Verification Checklist

  1. Inspect the rendered <head> with curl -s to confirm OG tags are present in the initial HTML, not injected by client-side JavaScript.
  2. Verify the og:image URL returns 200 OK with Content-Type: image/png (never text/html) and no redirect chain.
  3. Confirm og:title and og:description use properly escaped HTML entities so quotes or ampersands never break attributes.
  4. Test the live URL in a private Slack DM or Discord test channel before posting to public communities.

6. Match Card Content to Landing-Page Expectations

Never use clickbait or mismatched metrics on your social card. If the preview image promises a "5-Minute Next.js Webhook Guide" with a code snippet, the first screen after clicking should deliver that exact title and quickstart immediately. Consistent visual hierarchy between your OG card and your article header reduces pogo-sticking—when users bounce back to X or Hacker News within seconds—and builds long-term brand recognition every time an engineer spots your domain's cards in their feed.

7. Handle Dynamic Routes, Fallbacks, and Image Caching

Always configure a static fallback image (for example, /og/default.png) in your layout template so newly added documentation pages or author archives never emit a broken 404 in og:image. Serve generated OG PNGs with Cache-Control: public, max-age=31536000, immutable when their filename includes a content hash or slug version, and avoid signing image URLs with expiring tokens that break older Slack threads weeks later. Finally, test your Open Graph tags on both desktop and mobile clients after every CDN rule change—especially if you enable hotlink protection or strict Cross-Origin-Resource-Policy headers that can inadvertently block third-party social crawlers.

Cache Invalidation Tip

Social crawlers aggressively cache OG metadata for days or weeks. Always test new templates in a local Open Graph previewer before sharing a launch link, and append a version query parameter like ?v=2 to og:image whenever you redesign an existing card.

Sources & Further Reading