sitemap.xml configured with nuxt.config.js the most basic config is same as with robots.txt while more elaborate config can be done by adding sitemap object to the config file.
scseComponents: {
...
site: {
url: 'PRODUCTION_URL',
}
...
}
site.url is a required option for the sitemap.xml to work properly.
More detailed documentation can be found on the Nuxt SEO page .
Aside from listing pages to index the sitemap can also list images, videos. To do this you can either add config to the nuxt.config.js for each image individually or configure nitro crawler.
export default defineNuxtConfig({
sitemap: {
urls: [
{
loc: '/blog/my-post',
images: [
{
loc: 'https://example.com/image.jpg',
caption: 'My image caption',
geoLocation: 'My image geo location',
title: 'My image title',
license: 'My image license',
}
]
}
]
}
})
export default defineNuxtConfig({
nitro: {
prerender: {
// add any routes to prerender
routes: ['/']
}
}
})
More detailed documentation can be found on the Nuxt SEO Sitemap page .