Content Schemas

Complete Zod schema reference for Nuxt Content collections provided by @nuxtify/cms.

Overview

  • Provided by: @nuxtify/cms
  • Import from: @nuxtify/cms/content
  • Source: src/content.ts

@nuxtify/cms/content exports ready-to-use Zod schemas for every built-in Nuxt Content collection along with createSeoSchema. Each built-in collection schema automatically merges createSeoSchema('<collectionName>'), adding frontmatter support for robots, sitemap (with runtime draft and future publishedAt filtering), and schemaOrg.

Shared Schemas

createSeoSchema

createSeoSchema(name: string, options?: CreateSeoSchemaOptions) builds the SEO frontmatter schema merged into every built-in collection schema and registers a @nuxtjs/sitemap collection filter under name.

FieldSchema HelperDescription
robotsdefineRobotsSchema({ z })Per-page robots directives (false, 'noindex', or structured rules).
sitemapdefineSitemapSchema({ z, name, filter, onUrl })Per-page sitemap overrides (false to exclude, or { loc, lastmod, changefreq, priority }).
schemaOrgdefineSchemaOrgSchema({ z })Custom Schema.org JSON-LD node(s) overriding default generated nodes.

By default, createSeoSchema registers a runtime @nuxtjs/sitemap filter for name that excludes draft: true items, future publishedAt items (publishedAt > Date.now()), and invalid publishedAt values.

CreateSeoSchemaOptions

OptionTypeDefaultDescription
filterDefineSitemapSchemaOptions['filter'] | falseExcludes drafts & future/invalid publishedAtCustom runtime sitemap filter callback, or false to disable (and clear) the default filter for name. Because @nuxtjs/sitemap serializes callbacks via fn.toString() into the server bundle, custom callbacks must be self-contained (no outer closures).
onUrlDefineSitemapSchemaOptions['onUrl']undefinedOptional @nuxtjs/sitemap onUrl callback for customizing generated sitemap URLs.
ztypeof zBundled zodOptional Zod instance override forwarded to @nuxtjs/robots, @nuxtjs/sitemap, and nuxt-schema-org schema builders.

imageSchema

Reusable image object schema used across collections.

FieldTypeRequiredDescription
srcstringYesImage path or URL (used as fallback ogImage and Schema.org image).
altstringYesDescriptive alt text.

articleSchemaTypeEnum

Allowed values for schemaType on articles, notes, and docs:

  • 'Article'
  • 'BlogPosting'
  • 'NewsArticle'
  • 'TechArticle'
  • 'SocialMediaPosting'

Collection Schemas

pageSchema

Used for top-level marketing and legal pages (content/*.md).

FieldTypeRequiredDefaultDescription
publishedAtstring | DateYes—Publication date (normalized to UTC ISO-8601; supports scheduled publishing).
updatedAtstring | DateNoundefinedLast updated timestamp (emitted as dateModified in Schema.org).
overlinestringNoundefinedEyebrow text displayed above the page title.
align'left' | 'center' | 'right'NoundefinedHeader alignment passed to PageTitle.
showTitlebooleanNotrueSet to false on custom MDC landing pages that render their own PageHero.
imageimageSchemaNoundefinedPage feature / Open Graph image.
draftbooleanNofalseHides the page from queries, sitemap, and robots outside dev mode.
robots, sitemap, schemaOrgcreateSeoSchema('pages')No—Inherited SEO frontmatter fields and runtime sitemap filter.

articleSchema

Used for long-form blog posts (content/articles/*.md).

FieldTypeRequiredDefaultDescription
summarystring (max 250)NoundefinedShort excerpt shown on ArticleCard and used as Schema.org description fallback.
publishedAtstring | DateYes—Publication date (supports scheduled publishing).
updatedAtstring | DateNoundefinedLast updated timestamp.
authorstringYes—Contributor slug matching a file in content/contributors/ (e.g., 'jane-doe').
imageimageSchemaNoundefinedHero / Open Graph image.
draftbooleanNofalseExcludes the article outside dev mode when true.
topicsstring[]No[]Array of topic slugs matching content/topics/. The first topic displays as the primary topic.
readTimenumber | stringNoundefinedOptional manual reading time override (otherwise auto-calculated by useReadingTime).
tocbooleanNotrueControls whether the table of contents renders on this article.
schemaTypearticleSchemaTypeEnumNoundefinedOverrides content.articles.schemaType (default 'Article').
robots, sitemap, schemaOrgcreateSeoSchema('articles')No—Inherited SEO frontmatter fields and runtime sitemap filter.

contributorSchema

Used for author and team profiles (content/contributors/*.md).

FieldTypeRequiredDefaultDescription
namestringYes—Contributor full name.
jobTitlestringNoundefinedRole or title displayed in AuthorByline and ProfilePage Schema.org.
honorificSuffixstringNoundefinedOptional credentials suffix (e.g., 'PhD'), appended via honoraryName().
imageimageSchemaNoundefinedAvatar / profile photo.
draftbooleanNofalseExcludes the profile outside dev mode when true.
socialsobjectNoundefinedOptional social URLs: bluesky, facebook, instagram, github, linkedin, pinterest, tiktok, x, youtube, website (rendered as icon buttons and Schema.org sameAs).
robots, sitemap, schemaOrgcreateSeoSchema('contributors')No—Inherited SEO frontmatter fields and runtime sitemap filter.

topicSchema

Used for article category hubs (content/topics/*.md).

FieldTypeRequiredDefaultDescription
imageimageSchemaNoundefinedOptional topic image.
draftbooleanNofalseExcludes the topic outside dev mode when true.
robots, sitemap, schemaOrgcreateSeoSchema('topics')No—Inherited SEO frontmatter fields and runtime sitemap filter.

noteSchema

Used for short-form notes (content/notes/*.md, when content.notes.enabled is true).

FieldTypeRequiredDefaultDescription
publishedAtstring | DateYes—Publication date (supports scheduled publishing).
updatedAtstring | DateNoundefinedLast updated timestamp.
authorstringYes—Contributor slug matching content/contributors/.
imageimageSchemaNoundefinedOptional image.
draftbooleanNofalseExcludes the note outside dev mode when true.
tagsstring[]No[]Array of tag strings powering /tags/:slug pages.
schemaTypearticleSchemaTypeEnumNoundefinedOverrides content.notes.schemaType (default 'BlogPosting').
robots, sitemap, schemaOrgcreateSeoSchema('notes')No—Inherited SEO frontmatter fields and runtime sitemap filter.

docSchema

Used for documentation pages (content/docs/**).

FieldTypeRequiredDefaultDescription
iconstringNoundefinedOptional MDI icon rendered next to the page in DocsSidebar.
publishedAtstring | DateNoundefinedOptional publication timestamp (supports scheduled publishing when set).
updatedAtstring | DateNoundefinedOptional last updated timestamp.
imageimageSchemaNoundefinedOptional Open Graph / Schema.org image.
tocbooleanNotrueSet to false to hide the right-hand table of contents on this page.
prevNextbooleanNotrueSet to false to hide previous/next pagination cards on this page.
draftbooleanNofalseExcludes the doc page from sidebar navigation, queries, and sitemap outside dev mode.
schemaTypearticleSchemaTypeEnumNoundefinedOverrides content.docs.schemaType (default 'TechArticle').
robots, sitemap, schemaOrgcreateSeoSchema('docs')No—Inherited SEO frontmatter fields and runtime sitemap filter.

Extending Schemas for Custom Collections

Every schema exported from @nuxtify/cms/content is a standard Zod object. You can extend a built-in schema with .extend() or build a standalone schema with z.object()—keep .merge(createSeoSchema('<collectionName>')) even when extending a built-in schema like pageSchema, because each built-in schema registers its @nuxtjs/sitemap filter under its own collection name (such as 'pages') rather than your custom collection name:

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

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

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

export default defineContentConfig({
  collections: {
    useCases: defineCollection({
      type: 'page',
      source: 'use-cases/*.md',
      schema: useCaseSchema,
    }),
    episodes: defineCollection({
      type: 'page',
      source: 'episodes/*.md',
      schema: episodeSchema,
    }),
  },
})