nuxt-seo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nuxt SEO

Nuxt SEO

bash
npx nuxi module add @nuxtjs/seo
bash
npx nuxi module add @nuxtjs/seo

When 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
site
in
nuxt.config.ts
, access via
useSiteConfig()
. See references/site-config.md for full options.
所有SEO模块的基础。在
nuxt.config.ts
中配置
site
,通过
useSiteConfig()
访问。完整选项请查看references/site-config.md

Module Overview

模块概述

ModulePurposeKey API
nuxt-site-configShared config
useSiteConfig()
@nuxtjs/robotsrobots.txt
useRobotsRule()
@nuxtjs/sitemapsitemap.xml
defineSitemapEventHandler()
nuxt-og-imageOG images
defineOgImage()
nuxt-schema-orgJSON-LD
useSchemaOrg()
nuxt-seo-utilsMeta utilities
useBreadcrumbItems()
nuxt-link-checkerLink validationBuild-time checks
模块用途核心API
nuxt-site-config共享配置
useSiteConfig()
@nuxtjs/robotsRobots.txt管理
useRobotsRule()
@nuxtjs/sitemapSitemap.xml生成
defineSitemapEventHandler()
nuxt-og-imageOG图片生成
defineOgImage()
nuxt-schema-orgJSON-LD处理
useSchemaOrg()
nuxt-seo-utils元数据工具
useBreadcrumbItems()
nuxt-link-checker链接验证构建时检查

Nuxt Content v3

Nuxt Content v3

Use
asSeoCollection()
for automatic sitemap, og-image, and schema-org from frontmatter:
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
@nuxtjs/seo
before
@nuxt/content
in modules array:
ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/seo', '@nuxt/content']
})
Frontmatter fields:
ogImage
,
sitemap
,
robots
,
schemaOrg
.
使用
asSeoCollection()
从frontmatter自动生成sitemap、og-image和schema-org:
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/content
之前加载:
ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/seo', '@nuxt/content']
})
Frontmatter字段:
ogImage
,
sitemap
,
robots
,
schemaOrg
.

Related 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令牌。仅加载与当前任务相关的文件。