360 Secure SkillHub
360 安全技能中心

nuxt-content

为 Nuxt 项目提供 @nuxt/content 的类型化内容集合、查询、Markdown/MDC 渲染、配置与迁移指引,包含基线代码和按任务路由的参考文档,并要求用 nuxi typecheck 验证集合类型。

onmax
热度 33.65
最近更新 2026-10-19 02:47:27
分类:开发依赖:代码执行 / 读写文件应用场景:代码生成 / 调试排错

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add onmax/nuxt-skills/nuxt-content
Metadata
name
nuxt-content
description
Build typed, content-driven Nuxt applications with @nuxt/content. Use when working with content.config.ts, collections, queryCollection, Markdown or MDC rendering, content databases, hooks, custom sources, search, or Content v2 migrations.
license
MIT

Nuxt Content

Workflow

  1. Inspect the installed @nuxt/content version, content.config.ts, matching files under content/, and the Nuxt surface that consumes them. The branch is understood when the collection, source glob, schema, and consumer agree.
  2. Open the smallest matching guide below. Apply Nuxt Content guidance only to content-owned APIs; use Nuxt, Nuxt Studio, Nuxt UI, or Vue guidance when those packages own the remaining surface.
  3. Implement with typed collections and payload-backed Nuxt data loading. The change is complete when collection types resolve, the intended query returns the expected document shape, and the rendered route works in the target rendering mode.

Routing

Task Open
Collection types, schemas, indexes, local/remote sources, or locale prefixes Collections
Filtering, sorting, pagination, navigation, surroundings, or search Querying
Markdown, MDC, ContentRenderer, prose components, or code highlighting Rendering
Database adapters, markdown processing, renderer aliases, or deployment storage Configuration
Hooks, transformers, custom sources, raw content, debugging, or Content v2 migration Advanced
Visual editing, authentication, media, drafts, or Git publishing nuxt-studio skill
Writing or restructuring documentation prose document-writer skill

Baseline

// content.config.ts
import { defineCollection, defineContentConfig } from '@nuxt/content'
import { z } from 'zod'

export default defineContentConfig({
  collections: {
    docs: defineCollection({
      type: 'page',
      source: 'docs/**',
      schema: z.object({
        updatedAt: z.date().optional(),
      }),
    }),
  },
})
<script setup lang="ts">
const route = useRoute()
const { data: page } = await useAsyncData(route.path, () => {
  return queryCollection('docs').path(route.path).first()
})
</script>

<template>
  <ContentRenderer v-if="page" :value="page" />
</template>

Use npx nuxi typecheck to verify generated collection types. When a query is empty, confirm that its collection source includes the file—especially .navigation.yml—before changing query logic.