Sitemap
Guides
Sitemap Caching
Use the default cache engine to keep your sitemaps fast.
Caching your sitemap can help reduce the load on your server and improve performance.
By default, SWR caching is enabled on production environments and sitemaps will be cached for 10 minutes.
This is configured by overriding your route rules and leveraging the native Nuxt caching.
Cache Time
You can change the cache time by setting the cacheMaxAgeSeconds
option.
export default defineNuxtConfig({
sitemap: {
cacheMaxAgeSeconds: 3600 // 1 hour
}
})
If you want to disable caching, set the cacheMaxAgeSeconds
to 0
.
Cache Driver
The cache engine is set to the Nitro default of the cache/
path.
If you want to customise the cache engine, you can set the runtimeCacheStorage
option.
nuxt.config.ts
export default defineNuxtConfig({
sitemap: {
// cloudflare kv binding example
runtimeCacheStorage: {
driver: 'cloudflare-kv-binding',
binding: 'OG_IMAGE_CACHE'
}
}
})