本文へスキップ
Skillpedia
SNS48k · #5821

social-metadata-hardening

できること

このツールは、SNSやメッセージアプリで共有されたリンクが、ただのURLではなく、見栄えのよい完全なプレビューとして表示されるようにするためのものです。画像が表示されない、文章が間違っている、プレビューが古いままになっているといった問題を修正します。

使う場面

  • ✓共有したリンクで画像が表示されない、または違う画像が表示されるとき。
  • ✓リンクのプレビューを、意図したとおりの見た目にしたいとき。
  • ✓Webサイトを公開する前に、どこで共有してもリンクがきれいに見えるように確認したいとき。

スキルのリンク

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/social-metadata-hardening/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/social-metadata-hardening/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のWebサイトのリンクが、FacebookやWhatsAppできれいなプレビュー表示されるようにしてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、タイトル、説明文、画像などの重要な情報をWebサイトのコードに追加します。また、使用する画像が適切なサイズで、SNSが対応している形式になるように調整します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Social Metadata Hardening Skill

Fix social sharing so every important URL unfurls as a rich card across all platforms.


When to Use

  • Use when shared links show missing, stale, cropped, or incorrect previews on social and chat platforms.
  • Use when auditing Open Graph, Twitter/X card, image URL, alt text, or metadataBase coverage in a web app.
  • Use before launch when every public page needs predictable rich previews across LinkedIn, X, Facebook, WhatsApp, Slack, Discord, and Telegram.

Why Previews Break

Problem Root Cause
No preview at all Missing og:title, og:description, or og:image
Broken image Relative URL (must be absolute)
Wrong image size Image not 1200×630px (OG standard)
Plain text card Twitter card type missing or set to summary
Stale preview Platform caching old metadata
Metadata missing on crawl Tags added by client-side JS (crawlers don't run JS)

The Gold Standard Metadata Block

Every shareable page needs ALL of these in static HTML:

// Next.js App Router — lib/socialMetadata.js
export function buildSocialMetadata({
  title,
  description,
  path,          // '/blog/my-post'
  image,         // '/images/og/my-post.jpg' or full URL
  imageAlt,
  imageWidth = 1200,
  imageHeight = 630,
}) {
  const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://www.yourdomain.com';
  
  // Always produce an absolute URL
  const imageUrl = image?.startsWith('http') ? image : `${baseUrl}${image}`;
  const pageUrl  = `${baseUrl}${path}`;
  
  // Detect MIME type from extension
  const ext = imageUrl.split('.').pop().toLowerCase();
  const mimeMap = { jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', webp: 'image/webp' };
  const imageType = mimeMap[ext] || 'image/jpeg';

  return {
    title,
    description,
    alternates: { canonical: pageUrl },
    openGraph: {
      title,
      description,
      url: pageUrl,
      type: 'website',  // use 'article' for blog posts
      images: [{
        url: imageUrl,
        secureUrl: imageUrl,   // explicit HTTPS version
        width: imageWidth,
        height: imageHeight,
        alt: imageAlt || title,
        type: imageType,
      }],
    },
    twitter: {
      card: 'summary_large_image',  // NOT 'summary' — that shows a tiny image
      title,
      description,
      images: [imageUrl],
    },
  };
}

Applying the Helper

Static page

// app/about/page.js
import { buildSocialMetadata } from '@/lib/socialMetadata';

export const metadata = buildSocialMetadata({
  title: 'About Us | My Site',
  description: 'Learn about our team and mission.',
  path: '/about',
  image: '/images/og/about.jpg',
  imageAlt: 'The My Site team',
});

Dynamic page (blog post, tool page)

// app/blog/[slug]/page.js
import { buildSocialMetadata } from '@/lib/socialMetadata';

export async function generateMetadata({ params }) {
  const post = await getPost(params.slug);
  return buildSocialMetadata({
    title: `${post.title} | My Blog`,
    description: post.excerpt,
    path: `/blog/${params.slug}`,
    image: post.ogImage || '/images/og/default.jpg',
    imageAlt: post.title,
  });
}

Homepage (app/layout.js or app/page.js)

export const metadata = {
  metadataBase: new URL('https://www.yourdomain.com'), // REQUIRED for absolute URLs
  ...buildSocialMetadata({
    title: 'My Site — Tagline Here',
    description: 'Site-wide description.',
    path: '/',
    image: '/images/og/home.jpg',
  }),
};

⚠️ Set metadataBase when using relative metadata URLs. If your helper already outputs absolute canonical/OG URLs, previews can still work without it.


OG Image Checklist

Good OG images:

  • 1200 × 630px (2:1 ratio — works on all platforms)
  • Under 8MB (Facebook limit)
  • Served over HTTPS
  • File name has no spaces (use hyphens)
  • Format: JPEG or PNG (WebP works on most but not all crawlers)
  • Accessible via GET with no authentication
# Verify your OG image is reachable and correct size
curl -sI https://www.yourdomain.com/images/og/home.jpg | grep -i "content-type\|content-length\|status"

Platform-Specific Notes

Facebook / Meta

  • Caches aggressively — use the Sharing Debugger to force recrawl
  • Minimum image: 200×200px (but use 1200×630 for quality)
  • Needs: og:title, og:description, og:image, og:url

…

よくある質問

リンクのプレビューが壊れているのはなぜですか?

いくつかの原因が考えられます。タイトル、説明文、画像などの重要な情報が不足している、画像のリンクが相対パス(完全なURLではない形式)になっている、画像のサイズが適切でない、またはSNS側が古い情報(キャッシュ)を表示し続けている、といったケースです。

プレビュー用の画像は、どのくらいのサイズが理想ですか?

推奨サイズは、横1200ピクセル×縦630ピクセルです。このサイズであれば、どのプラットフォームでもきれいに表示されやすくなります。

すでにリンクを共有してしまった場合、プレビューを更新するにはどうすればよいですか?

Webサイトの問題を修正したあと、FacebookのデバッガーやX(旧Twitter)のCard Validatorなど、各SNSの専用ツールを使うと、リンクの情報を再取得させることができます。

詳細

作者による元の説明

Fix social sharing previews so URLs render as rich cards on Facebook, LinkedIn, X/Twitter, WhatsApp, Telegram, and more. Covers OG tags, Twitter cards, absolute image URLs, and debugging.

repo: sickn33/agentic-awesome-skills

人気

GitHubのスター
48k
ランキング
#5821
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル