Nuxt Sitemap v4.0.0 · Nuxt Sitemap · Nuxt SEO

[NuxtSEO](https://nuxtseo.com/ "Home")

- [Modules](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [Tools](https://nuxtseo.com/tools)
- [Pro](https://nuxtseo.com/pro)
- [Learn SEO](https://nuxtseo.com/learn-seo/nuxt) [Releases](https://nuxtseo.com/releases)

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

[User Guides](https://nuxtseo.com/docs/sitemap/getting-started/introduction)

[API](https://nuxtseo.com/docs/sitemap/api/config)

[Releases](https://nuxtseo.com/docs/sitemap/releases/v8)

Sitemap

- [Switch to Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [Switch to Nuxt SEO](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [Switch to Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)
- [Switch to OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)
- [Switch to Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)
- [Switch to Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)
- [Switch to SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)
- [Switch to Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)
- [Switch to Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)
- [Switch to AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

Search…```k`` /`

v8.0.11

- Playgrounds
- [Discord Support](https://discord.com/invite/275MBUBvgP)

### Changelog

### Releases

- [v8.0.0](https://nuxtseo.com/docs/sitemap/releases/v8)
- [v7.0.0](https://nuxtseo.com/docs/sitemap/releases/v7)
- [v6.0.0](https://nuxtseo.com/docs/sitemap/releases/v6)
- [v5.0.0](https://nuxtseo.com/docs/sitemap/releases/v5)
- [v4.0.0](https://nuxtseo.com/docs/sitemap/releases/v4)
- [v3.0.0](https://nuxtseo.com/docs/sitemap/releases/v3)

Releases

# Nuxt Sitemap v4.0.0

[Copy for LLMs](https://nuxtseo.com/docs/sitemap/releases/v4.md)

## [Background](#background)

Over the last couple of months I've had many issues reported with similar themes:

- Dynamic URLs are hard to work with
- It's difficult to get multiple sitemaps to show the correct URLs
- I18n has many small issues

I hope this release can resolve these. It has required replacing much of the underlying logic, please test your sitemaps after upgrading.

## [Features 🚀](#features)

### [🥫 Sitemap Sources](#sitemap-sources)

The v4 introduces the official concept of 'sources' to your sitemaps.

Every URL within your sitemap will belong to a source. A source will either be a User source or a Application source.

This concept existed before v4 in different forms, v4 aims to clean them up and make working with them much easier.

For full documentation see [Sitemap Sources](https://nuxtseo.com/docs/sitemap/getting-started/data-sources).

### [🤝 Nuxt Dev Tools Integration](#nuxt-dev-tools-integration)

Nuxt Sitemap now has a dedicated tab in Nuxt Dev Tools to help you debug.

<details>

<summary>

nuxt-simple-sitemap-devtools.webm</summary>



</details>

### [💬 More i18n Improvements](#more-i18n-improvements)

- Locale domain support ([#155](https://github.com/nuxt-modules/sitemap/issues/155))
- Support pages opt-outed using `defineI18nRoute(false)` ([#126](https://github.com/nuxt-modules/sitemap/issues/126))
- Only add trusted i18n routes, will use meta tags when prerendering
- Less aggressive filtering
- Opt-in to transform dynamic URLs `__i18nTransform: true`

See the updated [i18n documentation](https://nuxtseo.com/docs/sitemap/guides/i18n)

### [🚀 Caching Improvements](#caching-improvements)

Now utilises native route rules. By default will set up SWR rules for 10 minutes.

Learn more on the [Sitemap Caching](https://nuxtseo.com/docs/sitemap/advanced/performance) guide.

## [Other Improvements](#other-improvements)

### [Nitro Composables for better types](#nitro-composables-for-better-types)

When creating an API endpoint that returns URLs you should use the new [`defineSitemapEventHandler()`](https://nuxtseo.com/docs/sitemap/nitro-api/nitro-hooks) function for full TypeScript support.

```
// api/sitemap.ts
export default defineSitemapEventHandler(() => {
  return ['/foo']
})
```

### [Prerendering Improvements](#prerendering-improvements)

Previously prerendering was done in a Node context, this will now run in a Nitro context which will provide better consistency between prerender and runtime environments.

### [Video Support](#video-support)

Video entries are now supported properly. ([#159](https://github.com/nuxt-modules/sitemap/issues/159))

## [⚠️ Deprecations](#️-deprecations)

- `cacheTtl` is deprecated, you should use `cacheMaxAgeSeconds` which is more explicit.
- `inferStaticPagesAsRoutes` is deprecated, if you were using this to opt-out of pages, you should use `excludeAppSources: true`

## [☠️ Breaking Changes](#️-breaking-changes)

### [Nuxt Hooks no longer supported](#nuxt-hooks-no-longer-supported)

If you were using Nuxt hooks to modify the prerendered sitemap, you will need to migrate these to Nitro hooks.

nuxt.config.ts

```
export default defineNuxtConfig({
  hooks: {
    // old - no longer supported
    'sitemap:resolved': function (ctx) {},
    'sitemap:output': function (ctx) {}
  },
})
```

server/plugins/sitemap

```
export default defineNitroPlugin((nitroApp) => {
  nitroApp.hooks.hook('sitemap:output', async (ctx) => {
    // supported!
  })
})
```

### [Multi Sitemap App Sources](#multi-sitemap-app-sources)

By default, app sources will no longer be included in multi sitemap implementations. You will need to use `includeAppSources: true` to re-enable it. See [Extending App Sources](https://nuxtseo.com/docs/sitemap/guides/multi-sitemaps#extending-app-sources) for more information.

### [Removed deprecations](#removed-deprecations)

- The hook `sitemap:prerender` has been removed. You should use `sitemap:resolved` instead.
- The config `trailingSlash` and `siteUrl` has been removed. You should use site config, see [Setting Site Config](https://nuxtseo.com/docs/site-config/guides/how-it-works).
- The config `autoAlternativeLangPrefixes` has been removed. If you'd like to set up automatic alternative language prefixes use `__i18nTransform`.

## [Support my work](#support-my-work)

This release took over 40 hours. If technical SEO developer experience in Nuxt is important to you, consider [supporting my work](https://github.com/sponsors/harlan-zw) on Nuxt SEO.

[Edit this page](https://github.com/nuxt-modules/sitemap/edit/main/docs/content/5.releases/7.v4.md)

[Markdown For LLMs](https://nuxtseo.com/docs/sitemap/releases/v4.md)

Did this page help you?

[v5.0.0 Release notes for v5.0.0 of Nuxt Sitemap.](https://nuxtseo.com/docs/sitemap/releases/v5) [v3.0.0 Release notes for v3.0.0.](https://nuxtseo.com/docs/sitemap/releases/v3)

On this page

- [Background](#background)
- [Features 🚀](#features)
- [Other Improvements](#other-improvements)
- [⚠️ Deprecations](#️-deprecations)
- [☠️ Breaking Changes](#️-breaking-changes)
- [Support my work](#support-my-work)

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

### [NuxtSEO](https://nuxtseo.com/ "Home")

- [Getting Started](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [MCP](https://nuxtseo.com/docs/nuxt-seo/guides/mcp)

Modules

- [Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)
- [Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)
- [Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)
- [Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)
- [SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)
- [Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)
- [Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)
- [AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

### [NuxtSEO Pro](https://nuxtseo.com/pro "Home")

- [Getting Started](https://nuxtseo.com/pro)
- [Dashboard](https://nuxtseo.com/pro/dashboard)
- [Pro MCP](https://nuxtseo.com/docs/nuxt-seo-pro/mcp/installation)

### [Learn SEO](https://nuxtseo.com/learn-seo "Learn SEO")

Nuxt

- [Mastering Meta](https://nuxtseo.com/learn-seo/nuxt/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers)
- [Launch & Listen](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen)
- [Routes & Rendering](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering)
- [Staying Secure](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/security)

Vue

- [Vue SEO Guide](https://nuxtseo.com/learn-seo/vue)
- [Mastering Meta](https://nuxtseo.com/learn-seo/vue/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/vue/controlling-crawlers)
- [SPA SEO](https://nuxtseo.com/learn-seo/vue/spa)
- [SSR Frameworks](https://nuxtseo.com/learn-seo/vue/ssr-frameworks)
- [SEO Checklist](https://nuxtseo.com/learn-seo/checklist)
- [Pre-Launch Warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup)
- [Backlinks & Authority](https://nuxtseo.com/learn-seo/backlinks)

### [Tools](https://nuxtseo.com/tools "SEO Tools")

- [Social Share Debugger](https://nuxtseo.com/tools/social-share-debugger)
- [Robots.txt Generator](https://nuxtseo.com/tools/robots-txt-generator)
- [Meta Tag Checker](https://nuxtseo.com/tools/meta-tag-checker)
- [HTML to Markdown](https://nuxtseo.com/tools/html-to-markdown)
- [XML Sitemap Validator](https://nuxtseo.com/tools/xml-sitemap-validator)
- [Schema.org Validator](https://nuxtseo.com/tools/schema-validator)
- [Keyword Research Pro](https://nuxtseo.com/tools/keyword-research)
- [SERP Analyzer Pro](https://nuxtseo.com/tools/serp-analyzer)
- [Domain Rankings Pro](https://nuxtseo.com/tools/domain-rankings)

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)