Open Graph tags are the metadata that controls how your website appears when shared on social media — Facebook, Twitter (X), LinkedIn, Discord, Slack, and most messaging apps. If you've ever seen a link preview with a title, description, and image, that's Open Graph at work.
In this guide, you'll learn everything about implementing OG tags in Astro: from the basics to dynamic generation, SEO impact, debugging tools, and how EmDash's Auto Blog/SEO plugin handles it all automatically.
What Open Graph Tags Actually Do
When you share a URL on social media, the platform fetches the page and reads its OG meta tags to build a rich preview. Without them, you get a bare URL — ugly and low-click-through.
| Tag | Purpose | Example |
|-----|---------|--------|
| `og:title` | Title shown in the card | "Complete Guide to OG Tags" |
| `og:description` | 2-3 line summary below title | "Learn how to implement OG tags..." |
| `og:image` | Preview image URL | `https://example.com/og-card.png` |
| `og:url` | Canonical URL | `https://example.com/guide` |
| `og:type` | Content type | `website`, `article`, `product` |
| `og:site_name` | Your site name | "AIKit — EmDash Plugin Studio" |
Missing tags = the platform guesses (badly). You might get the wrong title, a random image, or no image at all.
Setting Up OG Tags in Astro: The Basics
Astro makes OG tags straightforward. Each page has a frontmatter script where you set metadata, then inject it into the `<head>`.
Minimal setup
```astro
---
// src/pages/blog/my-post.astro
const title = "My Blog Post";
const description = "A great blog post about things.";
const image = "/og/default.png";
---
<!doctype html>
<html>
<head>
<title>{title}</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
<meta property="og:url" content={Astro.url.href} />
<meta property="og:type" content="article" />
<meta property="og:site_name" content="AIKit" />
</head>
<body>
<slot />
</body>
</html>
```
Twitter Cards (X Cards)
Twitter uses its own `twitter:card` tags alongside OG tags. Always include both:
```astro
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={image} />
```
Dynamic OG Image Generation
Static OG images are fine. Dynamic ones are better. Tools like `@astro-community/og-image` or Satori (from Vercel) generate on-the-fly OG cards with your blog title, author, and site branding.
```javascript
// src/pages/og/[slug].png.ts
import { getCollection } from "astro:content";
import { generateOgImage } from "@astro-community/og-image";
export async function GET({ params }) {
const posts = await getCollection("blog");
const post = posts.find(p => p.slug === params.slug);
const png = await generateOgImage({
title: post.data.title,
description: post.data.excerpt,
siteName: "AIKit — EmDash Plugin Studio",
logo: "/logo.png",
});
return new Response(png, {
headers: { "Content-Type": "image/png" },
});
}
```
SEO Impact of Open Graph Tags
OG tags are a secondary ranking factor. They don't directly boost SERP rankings, but they dramatically improve click-through rates (CTR) from social shares and messaging apps. Higher CTR signals engagement to search engines.
| Metric | Without OG Tags | With OG Tags |
|--------|----------------|--------------|
| Social CTR | 2-5% | 15-30% |
| Link preview quality | Broken/incomplete | Full rich card |
| Brand perception | Unprofessional | Polished |
| Shareability | Low (ugly links) | High (easy to share) |
Schema.org Complement
For maximum SEO impact, pair OG tags with JSON-LD structured data:
```html
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Your Post Title",
"description": "Your excerpt",
"image": "https://example.com/og-image.png",
"author": {
"@type": "Organization",
"name": "AIKit"
},
"datePublished": "2026-04-27"
}
</script>
```
Debugging and Validation
Always test your OG tags before shipping:
- **Facebook Sharing Debugger** — https://developers.facebook.com/tools/debug/
- **Twitter Card Validator** — https://cards-dev.twitter.com/validator
- **LinkedIn Post Inspector** — https://www.linkedin.com/post-inspector/
- **Slack unfurling** — Paste your URL into Slack
- **Discord unfurling** — Paste into any Discord channel
Common issues:
- Image too large (>5MB or wrong aspect ratio 1.91:1)
- Missing `og:image:width` and `og:image:height`
- Relative URLs instead of absolute (platforms can't resolve them)
- Cache — platforms cache OG data for days. Use debuggers to force refresh.
How EmDash's Auto Blog/SEO Plugin Handles It
Instead of manually wiring OG tags into every Astro page template, the Auto Blog/SEO plugin for EmDash does it for you:
- **Automatic injection** — OG tags are generated from your post metadata during the build
- **Dynamic OG images** — Generates branded cards on publish
- **Bulk validation** — Runs all your pages through a validator and reports broken OG tags
- **SEO audit report** — Shows which pages are missing OG metadata
This is exactly what dog-fooding at AIKit looks like. Every blog post on ai-kit.net uses this plugin, including the one you're reading now.
Quick Checklist
Before publishing any post, verify:
- [ ] `og:title` matches the page `<title>`
- [ ] `og:description` is 2-4 sentences, under 200 chars
- [ ] `og:image` exists, is <5MB, aspect ratio 1.91:1
- [ ] `og:url` is the canonical URL (no trailing slash mismatch)
- [ ] `twitter:card` set to `summary_large_image`
- [ ] OG image renders correctly in the Facebook Debugger
- [ ] No broken images (run a headless browser check)
Summary
Open Graph tags are one of the highest-ROI SEO improvements you can make. They cost nothing to implement, work immediately, and improve how your content performs across every social platform, messaging app, and link-sharing service.
If you're on Astro, add OG tags to your layout template today. If you're on EmDash with the Auto Blog/SEO plugin, they're already there.
Related: "SEO Score vs AEO Citability: What Matters in 2026" — coming next week on AIKit.