Setup Module

Want to know why you might need this module? Check out the introduction.

To get started with Nuxt Sitemap, you need to install the dependency and add it to your Nuxt config.

Already using @nuxtjs/seo? Do not install this again unless you want to manage the Sitemap module separately. @nuxtjs/seo includes @nuxtjs/sitemap.
npx nuxt module add @nuxtjs/sitemap

Use Nuxt 4.6 or Nuxt 5. Use Node 22.22.3+, Node 24.15.0+, or Node 26+.

Using an AI agent? Get the @nuxtjs/sitemap Skill on skilld.dev/gh/nuxt-modules/sitemap.

Verifying Installation

After you've set up the module with the minimal config, you should be able to visit /sitemap.xml to see the generated sitemap.

You may notice that the URLs point to your localhost domain. This is to make navigating your local site easier, and will be updated when you deploy your site.

All pages present in your app are discovered from your Application Sources. For CMS, database, or API-backed routes, see Dynamic URLs.

You can debug this further in Nuxt DevTools under the Sitemap tab.

The Sitemap DevTools tab needs the nuxtseo-devtools-host package. Install it as a dev dependency with pnpm add -D nuxtseo-devtools-host, then restart the dev server. You do not add it to modules.

Configuration

At a minimum the module requires a Site URL to be set. This is to ensure only your canonical domain is being used for the sitemap. A site name can also be provided to customize the sitemap stylesheet.

Without a Site URL, your sitemap will use localhost in production.
Site Config Quick Setup
export default defineNuxtConfig({
  site: {
    url: 'https://example.com',
    name: 'My Awesome Website'
  },
})

For more advanced configurations, read the site config guide.

To ensure search engines find your sitemap, you will need to add it to your robots.txt. It's recommended to use the Nuxt Robots module for this.

Robots 
   
Tame the robots crawling and indexing your site with ease.

Every site is different and will require its own further unique configuration, to give you a head start:

  • Dynamic URL Endpoint - If you have dynamic URLs you need to add to the sitemap, you can use a runtime API endpoint. For example, if you're generating your site from a CMS.
  • Multi Sitemaps - If you have 10k+ pages, you may want to split your sitemap into multiple files so that search engines can process them more efficiently.

You do not need to worry about any further configuration in most cases, check the best practices guide for more information.

Next Steps

You've successfully installed Nuxt Sitemap. Here's the recommended reading path:

  1. Data Sources - Understand where your sitemap URLs come from
  2. Dynamic URLs - Add URLs from a CMS or database
  3. Best Practices - Ensure your sitemap follows SEO guidelines

Using other Nuxt modules?

Ready to deploy? Check out Submitting Your Sitemap.

Was this page helpful?