nuxt-seo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNuxt SEO
Nuxt SEO
bash
npx nuxi module add @nuxtjs/seobash
npx nuxi module add @nuxtjs/seoWhen to Use
适用场景
Working with:
- SEO configuration (site URL, name, indexability)
- Robots.txt and sitemap.xml generation
- Dynamic OG image generation
- JSON-LD structured data (schema.org)
- Breadcrumbs and canonical URLs
适用于以下工作场景:
- SEO配置(站点URL、名称、可索引性)
- Robots.txt和sitemap.xml生成
- 动态OG图片生成
- JSON-LD结构化数据(schema.org)
- 面包屑和规范URL
Loading Files
加载文件
Consider loading these reference files based on your task:
- references/site-config.md - if configuring site URL, name, or SEO foundation
- references/crawlability.md - if setting up robots.txt or sitemap.xml
- references/og-image.md - if generating dynamic OG images
- references/schema-org.md - if adding JSON-LD structured data
- references/utilities.md - if working with breadcrumbs, canonical URLs, or link checking
DO NOT load all files at once. Load only what's relevant to your current task.
请根据你的任务加载以下参考文件:
- references/site-config.md - 若需配置站点URL、名称或SEO基础设置
- references/crawlability.md - 若需设置robots.txt或sitemap.xml
- references/og-image.md - 若需生成动态OG图片
- references/schema-org.md - 若需添加JSON-LD结构化数据
- references/utilities.md - 若需处理面包屑、规范URL或链接检查
请勿一次性加载所有文件。仅加载与当前任务相关的文件。
Site Config
站点配置
Foundation for all SEO modules. Configure in , access via . See references/site-config.md for full options.
sitenuxt.config.tsuseSiteConfig()所有SEO模块的基础。在中配置,通过访问。完整选项请查看references/site-config.md。
nuxt.config.tssiteuseSiteConfig()Module Overview
模块概述
| Module | Purpose | Key API |
|---|---|---|
| nuxt-site-config | Shared config | |
| @nuxtjs/robots | robots.txt | |
| @nuxtjs/sitemap | sitemap.xml | |
| nuxt-og-image | OG images | |
| nuxt-schema-org | JSON-LD | |
| nuxt-seo-utils | Meta utilities | |
| nuxt-link-checker | Link validation | Build-time checks |
| 模块 | 用途 | 核心API |
|---|---|---|
| nuxt-site-config | 共享配置 | |
| @nuxtjs/robots | Robots.txt管理 | |
| @nuxtjs/sitemap | Sitemap.xml生成 | |
| nuxt-og-image | OG图片生成 | |
| nuxt-schema-org | JSON-LD处理 | |
| nuxt-seo-utils | 元数据工具 | |
| nuxt-link-checker | 链接验证 | 构建时检查 |
Nuxt Content v3
Nuxt Content v3
Use for automatic sitemap, og-image, and schema-org from frontmatter:
asSeoCollection()ts
// content.config.ts
import { defineCollection, defineContentConfig } from '@nuxt/content'
import { asSeoCollection } from '@nuxtjs/seo/content'
export default defineContentConfig({
collections: {
posts: defineCollection(asSeoCollection({ type: 'page', source: 'posts/**' }))
}
})Important: Load before in modules array:
@nuxtjs/seo@nuxt/contentts
export default defineNuxtConfig({
modules: ['@nuxtjs/seo', '@nuxt/content']
})Frontmatter fields: , , , .
ogImagesitemaprobotsschemaOrg使用从frontmatter自动生成sitemap、og-image和schema-org:
asSeoCollection()ts
// content.config.ts
import { defineCollection, defineContentConfig } from '@nuxt/content'
import { asSeoCollection } from '@nuxtjs/seo/content'
export default defineContentConfig({
collections: {
posts: defineCollection(asSeoCollection({ type: 'page', source: 'posts/**' }))
}
})重要提示: 在modules数组中,要在之前加载:
@nuxtjs/seo@nuxt/contentts
export default defineNuxtConfig({
modules: ['@nuxtjs/seo', '@nuxt/content']
})Frontmatter字段:, , , .
ogImagesitemaprobotsschemaOrgRelated Skills
相关技能
- nuxt-content - For MDC rendering with SEO frontmatter
- nuxt-content - 用于结合SEO frontmatter的MDC渲染
Links
链接
Token Efficiency
令牌效率
Main skill: ~250 tokens. Each sub-file: ~400-600 tokens. Only load files relevant to current task.
主技能:约250令牌。每个子文件:约400-600令牌。仅加载与当前任务相关的文件。