Content Collections

Configure built-in collections, customize route prefixes, disable unused sections, and add custom collections.

Built-In Collections

@nuxtify/cms is built on Nuxt Content and provides six structured collections out of the box (plus /tags/:slug routes linked to notes):

CollectionDefault SourceDefault RouteEnabled by DefaultSchema
pages*.md/:slug?Always onpageSchema
articlesarticles/*.md/articles, /articles/:slugtruearticleSchema
topicstopics/*.md/topics, /topics/:slugtruetopicSchema
contributorscontributors/*.md/contributors, /contributors/:slugtruecontributorSchema
docsdocs/**/docs/:slug(.*)*truedocSchema
notesnotes/*.md/notes, /notes/:slug (+ /tags/:slug)falsenoteSchema

Each collection comes with pre-built list and detail pages, structured JSON-LD schema, draft filtering in production, and sitemap integration.

Wiring Collections in content.config.ts

Define the collections your site uses in content.config.ts at your project root. Import the built-in schemas from @nuxtify/cms/content—each includes Zod validation for frontmatter plus createSeoSchema('<collectionName>') (robots, sitemap with runtime draft and scheduled-post filtering, and schemaOrg):

// content.config.ts
import { defineCollection, defineContentConfig } from '@nuxt/content'
import {
  articleSchema,
  contributorSchema,
  docSchema,
  pageSchema,
  topicSchema,
} from '@nuxtify/cms/content'

export default defineContentConfig({
  collections: {
    pages: defineCollection({
      type: 'page',
      source: '*.md',
      schema: pageSchema,
    }),
    articles: defineCollection({
      type: 'page',
      source: 'articles/*.md',
      schema: articleSchema,
    }),
    topics: defineCollection({
      type: 'page',
      source: 'topics/*.md',
      schema: topicSchema,
    }),
    contributors: defineCollection({
      type: 'page',
      source: 'contributors/*.md',
      schema: contributorSchema,
    }),
    docs: defineCollection({
      type: 'page',
      source: 'docs/**',
      schema: docSchema,
    }),
  },
})

Enabling, Disabling, and Renaming Routes

Everything works with defaults—you only need to add nuxtifyCms.content in nuxt.config.ts when you want to toggle a collection or change its URL prefix:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxt/content', '@nuxtify/cms'],

  nuxtifyCms: {
    content: {
      // Rename /articles to /blog
      articles: {
        routePrefix: '/blog',
        title: 'Blog',
        subtitle: 'Guides and release updates.',
      },
      // Opt into short-form notes (also enables /tags)
      notes: {
        enabled: true,
      },
      // Disable unused sections (automatically excluded from sitemap.xml)
      contributors: {
        enabled: false,
      },
    },
  },
})

When a collection is disabled in nuxt.config.ts:

  • Its routes are not registered in Vue Router.
  • Its route prefix and child paths are automatically added to sitemap.exclude.
  • Parsed items in that collection receive sitemap: false and robots: false.

Adding Custom Collections

Need a domain-specific collection like useCases, episodes, or changelog? Define a custom schema—either by extending a built-in schema from @nuxtify/cms/content or building one from scratch with z.object()—merge createSeoSchema('<collectionName>') so @nuxtjs/sitemap registers runtime draft and publishedAt filtering under your collection's name, register the collection in content.config.ts, and query it with usePublicCollection().

1. Define a Custom Schema

Extend pageSchema to inherit standard page fields alongside your custom properties. Keep .merge(createSeoSchema('<collectionName>')) even when extending pageSchema, because pageSchema's built-in sitemap filter is registered under 'pages' rather than your custom collection name:

// app/utils/contentSchemas.ts
import { createSeoSchema, pageSchema } from '@nuxtify/cms/content'
import { z } from 'zod'

export const useCaseSchema = pageSchema.extend({
  label: z.string().optional(),
  related: z.array(z.string()).default([]).optional(),
}).merge(createSeoSchema('useCases'))

Or define a standalone schema from scratch and merge createSeoSchema('<collectionName>'):

// app/utils/contentSchemas.ts
import { createSeoSchema } from '@nuxtify/cms/content'
import { z } from 'zod'

export const episodeSchema = z.object({
  publishedAt: z.union([z.string(), z.date()]),
  draft: z.boolean().default(false),
  episodeNumber: z.number(),
  season: z.number().optional(),
}).merge(createSeoSchema('episodes'))

2. Register in content.config.ts

useCases: defineCollection({
  type: 'page',
  source: 'use-cases/*.md',
  schema: useCaseSchema,
}),

3. Query with usePublicCollection

<!-- app/pages/use-cases/index.vue -->
<script setup lang="ts">
const { data: useCases } = await useAsyncData('use-cases', () =>
  usePublicCollection('useCases').order('title', 'ASC').all(),
)
</script>

Because usePublicCollection wraps Nuxt Content's queryCollection and automatically filters out draft: true entries (and future publishedAt items if the collection is listed in content.scheduledCollections), your custom collection inherits the same publishing safeguards as built-in collections.

Next Steps