Nuxt Content

How to use the Nuxt Sitemap module with Nuxt Content.

Nuxt Sitemap integrates with Nuxt Content out of the box.

It comes with automatic configuration when using document driven mode. Otherwise, you can opt in on each markdown file or set up your own app source.


Document Driven Mode

When using documentDriven mode, all paths will be automatically added to the sitemap.

export default defineNuxtConfig({
  // things just work!
  content: {
    documentDriven: true

If you're not using documentDriven mode and your content paths are the same as their real paths, you can enable strictNuxtContentPaths to get the same behaviour.

export default defineNuxtConfig({
  sitemap: {
    strictNuxtContentPaths: true

Markdown opt in

If you want to add markdown pages to your sitemap without any extra config, you can use the sitemap key on your frontmatter. You must provide a loc value, or the page must have a path.

  loc: /my-page
  lastmod: 2021-01-01
  changefreq: monthly
  priority: 0.8

# My Page

Nuxt Content App Source

If you'd like to set up a more automated Nuxt Content integration and your not using Document Driven mode, you can add content to the sitemap as you would with Dynamic URLs.

An example of what this might look like is below, customize to your own needs.

import { defineEventHandler } from 'h3'
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'
import { serverQueryContent } from '#content/server'
import { asSitemapUrl, defineSitemapEventHandler } from '#imports'

export default defineSitemapEventHandler(async (e) => {
  const contentList = (await serverQueryContent(e).find()) as ParsedContent[]
  return contentList
    .filter(c => c._path.startsWith('_articles'))
    .map((c) => {
      return asSitemapUrl({
        loc: `/blog/${c._path.replace('_articles', '')}`,
        lastmod: updatedAt
export default defineNuxtConfig({
  sitemap: {
    sources: [


Opt out from Sitemap

You can also disable the content from being used by passing in sitemap: false or robots: false.