SuperAPI AI 工具集

astro-seo

前端与建站

查看项目

更新于 10-16 14:57

技能介绍

用途

astro-seo 面向 Astro 6 站点,提供一套完整的 SEO 策略与参考指南。资料指出,Astro 默认零 JS 的特性使其天然对 SEO 友好。该技能覆盖的范围包括:为任意 Astro 页面添加 meta 标签与 Open Graph、生成用于富媒体摘要的 JSON-LD 结构化数据、配置 @astrojs/sitemap 以便搜索索引、使用 @astrojs/rss 配置 RSS 订阅源、创建 robots.txt 与 canonical URL 模式、为多语言 SEO 添加 hreflang,以及度量与改进 Core Web Vitals。

使用场景(When to Use)

  • 为任意 Astro 页面添加 meta 标签和 Open Graph
  • 生成用于富媒体摘要的 JSON-LD 结构化数据
  • 为搜索索引设置 @astrojs/sitemap
  • 使用 @astrojs/rss 配置 RSS 订阅源
  • 创建 robots.txt 与 canonical URL 模式
  • 为多语言 SEO 添加 hreflang
  • 度量并改进 Core Web Vitals

为什么 Astro 适合 SEO

资料列出以下特性与收益的对应关系:

特性 收益
默认零 JS 面向爬虫输出纯 HTML,可即时索引
静态输出 亚秒级 TTFB,Core Web Vitals 表现优秀
Astro.site 内置 canonical URL 构造能力
Islands 架构 仅对交互部分进行水合(hydrate)

核心概念

Head 组件模式

创建一个可复用的 <SEO /> 或 <Head /> 组件,接受 title、description、og、canonical 等 props,并放置在所有布局(layouts)中。使用 Astro.site 构造绝对 URL。

Canonical URL

始终使用 Astro.site 构造 canonical:

const canonical = new URL(Astro.url.pathname, Astro.site);

结构化数据

通过 <script type="application/ld+json" set:html={JSON.stringify(schema)} /> 注入 JSON-LD。资料明确要求使用 set:html 以避免 XSS——绝不使用模板字符串插值。

代理工作流(强制要求)

在任何实现(implementation)之前,使用 TeamCreate 生成 3 个代理:

  • fuse-ai-pilot:explore-codebase —— 分析现有布局、head 组件与元数据
  • fuse-ai-pilot:research-expert —— 通过 Context7/Exa 核实最新 SEO 最佳实践
  • mcp__context7__query-docs —— 查阅 Astro 6 sitemap/RSS 集成文档

实现之后,运行 fuse-ai-pilot:sniper 进行验证。

参考指南(Reference Guide)

概念类参考

主题 参考文件 何时查阅
Meta 标签与 OG meta-tags.md 设置 head 元数据
JSON-LD structured-data.md 富媒体摘要、schema.org
Sitemap 与 RSS sitemap-rss.md 搜索索引、订阅源
Canonical 与 hreflang canonical-hreflang.md 重复内容、国际化(i18n)
Core Web Vitals core-web-vitals.md LCP、CLS、FID 优化

模板

模板 何时使用
seo-head.md 可复用的 SEO head 组件
json-ld.md JSON-LD BlogPosting、WebSite 等 schema

最佳实践

  • 单一 Head 组件 —— 将所有 meta 集中到一个可复用组件中
  • 绝对 URL —— og:image 与 canonical 使用 Astro.site
  • JSON-LD 使用 set:html —— 防止 XSS 漏洞
  • sitemap + robots.txt —— 为可爬取性同时配置两者
  • 所有语言区域都加 hreflang —— 为语言变体包含 x-default

限制与未提供事项

资料未提供具体收费、价格、授权方式或安装步骤(除上述代理工作流与参考文件名外)。上述工作流中出现的 TeamCreate、fuse-ai-pilot 系列代理与 mcp__context7__query-docs 均按资料原文保留,未作扩展说明。