enabledbooleantrueWhether to generate the sitemap.
sortEntriesbooleantrueWhether the sitemap entries should be sorted or be shown in the order they were added.
When enabled the entries will be sorted by the loc, they will be sorted by the path segment
count and then alphabetically using String.localeCompare to ensure numbers are sorted correctly.
sourcesSitemapSource[][]The sources to use for the sitemap. See Data Sources and Dynamic URL Endpoint for details.
excludeAppSourcesboolean|AppSourceId[]falseWhether to exclude app sources from the sitemap.
appendSitemaps(string | { sitemap: string, lastmod?: Date })[]falseSitemaps to append to the sitemap index.
This will only do anything when using multiple sitemaps.
autoLastmodbooleanfalseWhether to automatically detect the lastmod date for each URL.
If the lastmod date can't be inferred from a route page file it will use the current Date.
sitemapsSitemapConfig[] | booleanfalseWhether to generate multiple sitemaps.
Each sitemap can have the following options:
sourcesSitemapSource[][]Data sources for this specific sitemap.
chunksboolean | numberundefinedEnable chunking for sitemap sources. This splits large collections of URLs from sources into multiple smaller sitemap files to stay within search engine limits.
true to enable chunking with the default chunk size (from defaultSitemapsChunkSize or 1000)5000 for 5000 URLs per chunk)false or leave undefined to disable chunkingNote: Chunking only applies to URLs from sources. Direct URLs in the urls property are not chunked.
export default defineNuxtConfig({
sitemap: {
sitemaps: {
products: {
sources: ['/api/products'],
chunks: 5000 // Split into files with 5000 URLs each
}
}
}
})
chunkSizenumberundefinedExplicitly set the chunk size for this sitemap. Takes precedence over the chunks property when both are specified.
export default defineNuxtConfig({
sitemap: {
sitemaps: {
posts: {
sources: ['/api/posts'],
chunks: true, // Enable chunking
chunkSize: 2500 // Use 2500 URLs per chunk
}
}
}
})
See the Chunking Sources guide for more details.
urlsstring[] | (() => string[] | Promise<string[]>)[]Static URLs to include in this sitemap.
include(string | RegExp)[]undefinedFilter URLs to include in this sitemap.
exclude(string | RegExp)[]undefinedFilter URLs to exclude from this sitemap.
defaultsSitemapItemDefaults{}Default values for all URLs in this sitemap.
includeAppSourcesbooleanfalseWhether to include automatic app sources in this sitemap.
See Multi Sitemaps for details.
defaultSitemapsChunkSizenumber | false1000The default chunk size when chunking is enabled for multi-sitemaps. This value is used when:
chunks: true (without specifying a number)chunkSize is explicitly set for the sitemapSet to false to disable chunking by default for all sitemaps.
export default defineNuxtConfig({
sitemap: {
defaultSitemapsChunkSize: 5000,
sitemaps: {
// These will use 5000 as chunk size
posts: {
sources: ['/api/posts'],
chunks: true
},
// This overrides the default
products: {
sources: ['/api/products'],
chunks: 10000
}
}
}
})
defaultsobject{}Default values for the sitemap.xml entries. See sitemaps.org for all available options.
urls() => MaybePromise<SitemapEntry[]> | MaybePromise<SitemapEntry[]>[]Provide custom URLs to be included in the sitemap.xml.
include(string | RegExp)[]['/**']Filter routes that match the given rules. See the Filtering URLs guide for details.
export default defineNuxtConfig({
sitemap: {
include: [
'/my-hidden-url'
]
}
})
exclude(string | RegExp)[]undefinedFilter routes that match the given rules. See the Filtering URLs guide for details.
export default defineNuxtConfig({
sitemap: {
exclude: [
'/my-secret-section/**'
]
}
})
xslstring | false/__sitemap__/style.xslThe path to the XSL stylesheet for the sitemap.xml. Set to false to disable.
discoverImagesbooleantrueWhether to discover images from routes when prerendering.
discoverVideosbooleantrueWhether to discover videos from routes when prerendering.
autoI18nundefined | boolean | { locales: NormalisedLocales; defaultLocale: string; strategy: 'prefix' | 'prefix_except_default' | 'prefix_and_default' }undefinedAutomatically add alternative language prefixes for each entry with the given prefixes. Set to false to disable.
When using the @nuxtjs/i18n module, this will automatically be set to the configured locales when left undefined.
sitemapNamestringsitemap.xmlModify the name of the root sitemap.
Note: This only works when you're not using the multiple sitemaps option.
strictNuxtContentPathsbooleanfalseWhether the paths within nuxt/content match their real paths. This is useful when you're using the nuxt/content module
without documentDriven mode.
cacheMaxAgeSecondsnumber60 * 10The time in seconds to cache the sitemaps.
sitemapsPathPrefixstring | false/__sitemap__/The path prefix for the sitemaps when using multiple sitemaps.
runtimeCacheStorageboolean | (Record<string, any> & { driver: string })trueThe storage engine to use for the cache. See Caching for details.
xslColumns({ label: string; width: `${string}%`; select?: string })[][
{ "label": "URL", "width": "50%" },
{ "label": "Images", "width": "25%", "select": "count(image:image)" },
{ "label": "Last Updated", "width": "25%", "select": "concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))" }
]
The columns to display in the XSL stylesheet.
xslTipsbooleantrueWhether to include tips on how to use the sitemap in the XSL stylesheet.
experimentalWarmUpbooleanfalseShould the sitemaps be warmed up when Nitro starts. This can be useful for large sitemaps.
experimentalCompressionbooleanfalseShould the sitemaps be compressed and streamed when the request accepts it.
creditsbooleantrueWhether to include a comment on the sitemaps on how it was generated.
debugbooleanfalseEnable to see debug logs and API endpoint.
The route at /__sitemap__/debug.json will be available in non-production environments.
See the Debugging guide for details.