Config
enabled
- Type:
boolean
- Default:
true
Whether to generate the sitemap.
sortEntries
- Type:
boolean
- Default:
true
Whether 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.
sources
- Type:
SitemapSource[]
- Default:
[]
The sources to use for the sitemap. See Data Sources and Dynamic URL Endpoint for details.
excludeAppSources
- Type:
boolean|AppSourceId[]
- Default:
false
Whether to exclude app sources from the sitemap.
appendSitemaps
- Type:
(string | { sitemap: string, lastmod?: Date })[]
- Default:
false
Sitemaps to append to the sitemap index.
This will only do anything when using multiple sitemaps.
autoLastmod
- Type:
boolean
- Default:
false
Whether 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.
sitemaps
- Type:
SitemapConfig[] | boolean
- Default:
false
Whether to generate multiple sitemaps.
See Multi Sitemaps for details.
defaultSitemapsChunkSize
- Type:
number
- Default:
1000
When using sitemaps: true
this will be the default chunk size for each sitemap.
defaults
- Type:
object
- Default:
{}
Default values for the sitemap.xml entries. See sitemaps.org for all available options.
urls
- Type:
() => MaybePromise<SitemapEntry[]> | MaybePromise<SitemapEntry[]>
- Default:
[]
Provide custom URLs to be included in the sitemap.xml.
include
- Type:
(string | RegExp)[]
- Default:
['/**']
Filter routes that match the given rules. See the Filtering URLs guide for details.
export default defineNuxtConfig({
sitemap: {
include: [
'/my-hidden-url'
]
}
})
exclude
- Type:
(string | RegExp)[]
- Default:
undefined
Filter routes that match the given rules. See the Filtering URLs guide for details.
export default defineNuxtConfig({
sitemap: {
exclude: [
'/my-secret-section/**'
]
}
})
xsl
- Type:
string | false
- Default:
/__sitemap__/style.xsl
The path to the XSL stylesheet for the sitemap.xml. Set to false
to disable.
discoverImages
- Type:
boolean
- Default:
true
Whether to discover images from routes when prerendering.
autoI18n
- Type:
undefined | boolean | { locales: NormalisedLocales; defaultLocale: string; strategy: 'prefix' | 'prefix_except_default' | 'prefix_and_default' }
- Default:
undefined
Automatically 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
.
sitemapName
- Type:
string
- Default:
sitemap.xml
Modify the name of the root sitemap.
Note: This only works when you're not using the multiple sitemaps
option.
strictNuxtContentPaths
- Type:
boolean
- Default:
false
Whether the paths within nuxt/content match their real paths. This is useful when you're using the nuxt/content
module
without documentDriven mode.
cacheMaxAgeSeconds
- Type:
number
- Default:
60 * 10
The time in seconds to cache the sitemaps.
runtimeCacheStorage
- Type:
boolean | (Record<string, any> & { driver: string })
- Default:
true
The storage engine to use for the cache. See Caching for details.
xslColumns
- Type:
({ label: string; width: `${string}%`; select?: string })[]
- Default:
[
{ "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.
xslTips
- Type:
boolean
- Default:
true
Whether to include tips on how to use the sitemap in the XSL stylesheet.
experimentalWarmUp
- Type:
boolean
- Default:
false
Should the sitemaps be warmed up when Nitro starts. This can be useful for large sitemaps.
experimentalCompression
- Type:
boolean
- Default:
false
Should the sitemaps be compressed and streamed when the request accepts it.
credits
- Type:
boolean
- Default:
true
Whether to include a comment on the sitemaps on how it was generated.
debug
- Type:
boolean
- Default:
false
Enable 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.