Drafts & Scheduled Publishing

Preview unpublished drafts locally while keeping them hidden in production, and schedule future posts with UTC-normalized publishedAt timestamps.

How Drafts Work (draft: true)

Every built-in @nuxtify/cms schema (pageSchema, articleSchema, contributorSchema, topicSchema, noteSchema, and docSchema) includes a draft boolean that defaults to false.

Add draft: true to any Markdown file while you're still writing or reviewing it:

---
title: Upcoming Release Announcement
description: Preview of our next milestone.
publishedAt: 2026-06-01T14:00:00Z
author: jane-doe
draft: true
---

What happens automatically depends on the environment:

  • In development (nuxt dev): Drafts remain visible everywhere—index pages, detail routes, navigation trees, and previous/next links—so you can author and preview them live.
  • In production (nuxt build / nuxt generate):
    • usePublicCollection, usePublicCollectionNavigation, and usePublicCollectionSurroundings filter out draft: true items.
    • Direct visits to a draft's URL return a 404 on built-in CMS routes.
    • @nuxtify/cms's content:file:afterParse hook sets sitemap: false and robots: false on draft documents so they never leak into sitemap.xml or search engine indexes.

Scheduled Publishing with publishedAt

You can also schedule content to go live at a future date and time without manually toggling draft. Leave draft: false (or omit it) and set publishedAt to a future timestamp:

---
title: Summer Launch Notes
description: Everything shipping in our Q3 release.
publishedAt: 2026-07-15T13:00:00-04:00
author: jane-doe
---

During parsing (content:file:afterParse), @nuxtify/cms normalizes every valid publishedAt value—whether written as a date string with a timezone offset or a YAML Date—into a canonical 24-character UTC ISO-8601 string (YYYY-MM-DDTHH:mm:ss.sssZ). That guarantees SQLite's lexicographical publishedAt <= nowIso query always compares exact UTC timestamps accurately across timezones.

In production, any item in a scheduled collection whose publishedAt is strictly in the future:

  • Is visible in nuxt dev for local preview.
  • Is filtered out of usePublicCollection, usePublicCollectionNavigation, and usePublicCollectionSurroundings until publishedAt <= now.
  • Is excluded from sitemap.xml dynamically at runtime until its release time passes. Then it becomes discoverable automatically.

Documents without a publishedAt value (such as undated docs pages) remain published normally.

Configuring content.scheduledCollections

By default, scheduled-publishing checks apply to four collections:

['articles', 'notes', 'pages', 'docs']

You can override this list in nuxt.config.ts (or app.config.ts). Your array replaces the default cleanly rather than merging into it:

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

  nuxtifyCms: {
    content: {
      // Include a custom collection alongside articles and docs
      scheduledCollections: ['articles', 'docs', 'useCases'],
    },
  },
})

To disable scheduled-publishing checks globally and treat every non-draft document as immediately live, pass an empty array:

nuxtifyCms: {
  content: {
    scheduledCollections: [],
  },
}

Per-Query Overrides

When querying a collection directly with usePublicCollection, usePublicCollectionNavigation, or usePublicCollectionSurroundings, you can override scheduled filtering for a single query with { filterScheduled: true | false }:

// Include future-dated items in a custom "Upcoming" view while still excluding drafts
const { data: upcoming } = await useAsyncData('upcoming-articles', () =>
  usePublicCollection('articles', { filterScheduled: false })
    .order('publishedAt', 'ASC')
    .all(),
)

Scheduled Posts on Static & Prerendered Sites

How scheduled content goes live depends on your rendering strategy:

  • SSR (Node.js, Cloudflare Workers, serverless): usePublicCollection evaluates new Date().toISOString() on each request, and createSeoSchema's default @nuxtjs/sitemap filter checks publishedAt <= Date.now() dynamically at runtime. Scheduled items appear on your pages and in sitemap.xml automatically as soon as their publishedAt time passes without needing a rebuild. If you cache routes with SWR/ISR (routeRules), the page updates on the next revalidation.
  • Static / Prerendered (nuxt generate or nitro.prerender): HTML and sitemap.xml are baked at build time. Trigger a scheduled rebuild (for example, via a daily or hourly GitHub Actions cron calling your host's deploy hook) so newly live posts get prerendered and added to your sitemap.

Next Steps