Open Graph

作者 kostja948dd89c57395e无许可证1K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库2天前更新

When the user wants to add, audit, implement, or optimize Open Graph metadata for social sharing, including og:title, og:description, og:image, og:url, Facebook previews, LinkedIn previews, or social share previews. For a full metadata lifecycle use page-metadata; for X-specific previews use twitter-cards.

AI 生成的概览

编写和审查 Open Graph 元数据,让分享链接显示丰富的社交预览卡片。

功能
提供四个必备 Open Graph 标签(og:title、og:description、og:image、og:url)的规则与模板,以及推荐标签,如 og:type、og:site_name、图片尺寸、替代文本和语言区域。它给出图片规范、常见错误清单,并展示 Next.js App Router 与通用 HTML 的实现片段。它还说明如何用 Facebook 和 LinkedIn 的预览工具测试已部署 URL,并解释 Open Graph 文案与 SEO 元数据之间的关系。
适用场景
在为社交分享添加、审查、实现或优化 Open Graph 元数据时使用,包括 Facebook 和 LinkedIn 链接预览。也适用于分享卡片缺失、图片为相对路径或错误、或直接套用通用 SEO 文案的情况。完整页面元数据生命周期请用 page-metadata,X 专用预览请用 twitter-cards。
运行要求
无需脚本或依赖包;代理只需能够读取和编辑目标项目的元数据文件。访问网络有助于用 Facebook Sharing Debugger 和 LinkedIn Post Inspector 测试已部署的 URL。

SEO On-Page: Open Graph

Owns Open Graph writing and implementation rules for social previews. page-metadata owns the full-page lifecycle and release verification.

When invoking: On first use, if helpful, open with 1–2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.

Scope (Social Sharing)

  • Open Graph: Facebook-originated protocol; controls preview card when links are shared on social platforms

The 4 Essential Tags

Every shareable page requires these minimum tags:

html
<meta property="og:title" content="Your Page Title"><meta property="og:description" content="Your description"><meta property="og:image" content="https://yourdomain.com/image.png"><meta property="og:url" content="https://yourdomain.com/page">
TagGuideline
og:titleConcise and useful in a sharing context; same page identity as SEO title, not necessarily identical text
og:descriptionAccurate social summary; may differ from the meta description without changing the promise
og:imageAbsolute HTTPS URL; representative of the page; include dimensions when known
og:urlStable public page identity; normally the same URL declared canonical

Recommended Additional Tags

TagPurpose
og:typeContent type: website, article, video, product
og:site_nameWebsite name; displayed separately from title
og:image:width / og:image:heightImage dimensions (1200×630px)
og:image:altAlt text for accessibility
og:localeLanguage/territory (e.g., en_US); for multilingual sites

Image Best Practices

ItemGuideline
SizeUse a high-resolution image and verify the target platforms' current requirements; 1200×630 is a common cross-platform starting point
FormatUse a platform-supported web image format and verify the deployed response
URLAbsolute URL with https://; no relative paths
UniqueOne unique image per page when possible

Common Mistakes

  • Using relative image URLs instead of absolute https://
  • Images too small or wrong aspect ratio
  • Empty or placeholder values
  • Missing og:url (canonical)
  • Reusing a generic logo or unrelated image when a representative page image is available
  • Copying SEO title/description mechanically when the share context needs different wording

Implementation

Next.js (App Router)

tsx
export const metadata = {  openGraph: {    title: '...',    description: '...',    url: 'https://example.com/page',    siteName: 'Example',    images: [{ url: 'https://example.com/og.jpg', width: 1200, height: 630, alt: '...' }],    locale: 'en_US',    type: 'website',  },};

HTML (generic)

html
<meta property="og:title" content="Your Title"><meta property="og:description" content="Your description"><meta property="og:image" content="https://example.com/og.jpg"><meta property="og:url" content="https://example.com/page"><meta property="og:type" content="website"><meta property="og:site_name" content="Your Site"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta property="og:image:alt" content="Alt text">

Testing

Preview services cache metadata. Test the deployed absolute URL and refresh the cache when supported. Also inspect the raw initial HTML; a client-only tag insertion may not be available to every scraper.

Consistency boundary

Open Graph and SEO metadata may use different copy because search and social feeds are different contexts. They must still identify the same page, describe the same product or content, and avoid unsupported claims. Do not require string equality.

Related Skills

  • social-share-generator: Share buttons use OG tags for rich previews when users share; OG must be set for share buttons to show proper cards
  • article-page-generator: Use og:type article for article/post pages; article-specific tags (published_time, author)
  • page-metadata: Full lifecycle, source-of-truth implementation, and production validation
  • title-tag, meta-description: Search copy; may differ while preserving page identity
  • twitter-cards: Twitter uses OG as fallback; add Twitter-specific tags for best results
  • canonical-tag: og:url should match canonical URL
  • og-image-generator: Programmatic OG image generation — 6 visual styles (Terminal/CLI, Magazine Editorial, Swiss Minimal, Pixel Retro, Brutalist, Newspaper), Satori+resvg, Puppeteer, AI image generation tools, and Agent-Native content-aware workflow. This skill covers how to SET the image tag; og-image-generator covers how to CREATE the image.

来源与署名

来源:kostja94/marketing-skills位于skills/seo/on-page/open-graph提交8dd89c5

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架