metadata

A page-metadata command for generating search and social-sharing information. Metadata includes details such as page titles, descriptions, canonical URLs, and preview cards.

In plain words
What is it for?
Use it with a page path or URL path to create metadata for Next.js App Router, Next.js Pages Router, or plain HTML pages.
Why use it?
It removes the need to write these tags manually for each page and helps keep different web frameworks’ metadata formats consistent.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/huifer/claude-code-seo/metadata
Clone the repo
git clone --depth 1 https://github.com/huifer/claude-code-seo
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,206 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00007 $0.03206
Opus 5 $0.00003 $0.01603
Sonnet 5 $0.00001 $0.00641
Haiku 4.5 $0.00001 $0.00321

Measured 2d ago against content hash 5802cea7bfb1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

metadata scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/metadata.md · 449 lines

How it starts

The opening of the file, as written. The whole thing — 449 lines — stays where its author put it; the contents beside it link to each section on GitHub.

为指定页面生成 SEO 友好的元数据,包括 Title、Meta Description、Open Graph 标签和 Twitter Cards 标签。

功能

根据页面内容自动生成:

  • ✅ 优化的 Title 标签
  • ✅ 吸引人的 Meta Description
  • ✅ 完整的 Open Graph 标签
  • ✅ Twitter Cards 标签
  • ✅ Canonical URL
  • ✅ 其他有用的 meta 标签

参数

  • $1$ARGUMENTS: 页面路径(必需)
    • 可以是文件路径
    • 可以是 URL 路径
    • 示例:app/about/page.tsx/aboutabout

支持的框架/模式

Next.js App Router

// app/[path]/page.tsx
import { Metadata } from 'next'

export const metadata: Metadata = {
  title: '...',
  description: '...',
  openGraph: {
    title: '...',
    description: '...',
    images: ['/og-image.jpg'],
  },
}

Next.js Pages Router

// pages/[path].tsx
import Head from 'next/head'

export default function Page() {
  return (
    <Head>
      <title>...</title>
      <meta name="description" content="..." />
      {/* Other meta tags */}
    </Head>
  )
}

纯 HTML

<head>
  <title>...</title>
  <meta name="description" content="..." />
  <!-- Other meta tags -->
</head>

使用示例

示例 1:为关于页面生成元数据

/metadata app/about/page.tsx

输出:

# 为关于页面生成的元数据

## 基本信息
- 页面类型:关于页面
- 检测语言:中文
- 目标关键词:关于我们、团队、公司介绍

## App Router 实现

将以下代码添加到 `app/about/page.tsx`:

\`\`\`typescript
import { Metadata } from 'next'

export const metadata: Metadata = {
  title: '关于我们 | YourBrand - 专业团队介绍',
  description: '了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。立即联系我们了解更多!',
  keywords: ['关于我们', '团队介绍', '公司使命', 'YourBrand'],
  authors: [{ name: 'YourBrand Team', url: 'https://yourbrand.com/team' }],
  creator: 'YourBrand',
  publisher: 'YourBrand',

  openGraph: {
    type: 'website',
    locale: 'zh_CN',
    url: 'https://yourbrand.com/about',
    title: '关于我们 | YourBrand',
    description: '了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。',
    siteName: 'YourBrand',
    images: [
      {
        url: 'https://yourbrand.com/images/og-about.jpg',
        width: 1200,
        height: 630,
        alt: '关于我们 - YourBrand',
      },
    ],
  },

  twitter: {
    card: 'summary_large_image',
    title: '关于我们 | YourBrand - 专业团队介绍',
    description: '了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。',
    images: ['https://yourbrand.com/images/og-about.jpg'],
    creator: '@yourbrand',
  },

  alternates: {
    canonical: 'https://yourbrand.com/about',
  },
}
\`\`\`

## Pages Router 实现

将以下代码添加到 `pages/about.tsx`:

\`\`\`typescript
import Head from 'next/head'

export default function AboutPage() {
  return (
    <Head>
      <title>关于我们 | YourBrand - 专业团队介绍</title>
      <meta name="description" content="了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。立即联系我们了解更多!" />
      <meta name="keywords" content="关于我们,团队介绍,公司使命,YourBrand" />

      {/* Open Graph */}
      <meta property="og:type" content="website" />
      <meta property="og:locale" content="zh_CN" />
      <meta property="og:url" content="https://yourbrand.com/about" />
      <meta property="og:title" content="关于我们 | YourBrand" />
      <meta property="og:description" content="了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。" />
      <meta property="og:site_name" content="YourBrand" />
      <meta property="og:image" content="https://yourbrand.com/images/og-about.jpg" />
      <meta property="og:image:width" content="1200" />
      <meta property="og:image:height" content="630" />
      <meta property="og:image:alt" content="关于我们 - YourBrand" />

      {/* Twitter Card */}
      <meta name="twitter:card" content="summary_large_image" />
      <meta name="twitter:title" content="关于我们 | YourBrand - 专业团队介绍" />
      <meta name="twitter:description" content="了解我们的专业团队、公司使命和价值观。我们致力于为客户提供优质的服务,拥有10年行业经验。" />
      <meta name="twitter:image" content="https://yourbrand.com/images/og-about.jpg" />
      <meta name="twitter:creator" content="@yourbrand" />

      {/* Canonical */}
      <link rel="canonical" href="https://yourbrand.com/about" />
    </Head>
  )
}
\`\`\`

## 优化说明

✅ Title 长度:26 字符(建议:20-30)✓
✅ Description 长度:78 字符(建议:70-80)✓
✅ 包含主要关键词:关于我们✓
✅ 包含行动号召:立即联系我们✓
✅ 包含品牌名称:YourBrand✓

## 下一步

1. 更新文件中的元数据
2. 创建或更新 OG 图片(1200x630px)
3. 在社交媒体上测试预览效果
4. 使用 /seo-check 验证

需要我调整任何内容吗?

Read the full file on GitHub · 449 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 449 lines · 7 tokens per session scan A 5802cea7bfb1

Subscribe to this mod's changes

metadata is a command published in the GitHub repository huifer/claude-code-seo (110 stars, last pushed 8mo ago), licensed MIT. It adds 7 tokens to every session and 3,206 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.