Install Nuxt Sitemap · Nuxt Sitemap · Nuxt SEO

-
-
-
-

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

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

Sitemap

-
-
-
-
-
-
-
-
-
-

Search…```k`` /`

v8.0.12

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

### Getting Started

-
-
-
-

### Core Concepts

-
-
-
-
-
-
-
-
-

### Advanced

-
-
-
-
-

Getting Started

# Install Nuxt Sitemap

[Copy for LLMs](https://nuxtseo.com/docs/sitemap/getting-started/installation.md)

## [Setup Module](#setup-module)

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

.

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

nuxt

npm

yarn

pnpm

bun

bash

`npx nuxt module add @nuxtjs/sitemap`

bash

`npm i @nuxtjs/sitemap`

You will need to manually add the module to your Nuxt config.

nuxt.config.ts

```
export default defineNuxtConfig({
  modules: [
    '@nuxtjs/sitemap',
  ],
})
```

bash

`yarn add @nuxtjs/sitemap`

You will need to manually add the module to your Nuxt config.

nuxt.config.ts

```
export default defineNuxtConfig({
  modules: [
    '@nuxtjs/sitemap',
  ],
})
```

bash

`pnpm i @nuxtjs/sitemap`

You will need to manually add the module to your Nuxt config.

nuxt.config.ts

```
export default defineNuxtConfig({
  modules: [
    '@nuxtjs/sitemap',
  ],
})
```

bash

`bun i @nuxtjs/sitemap`

You will need to manually add the module to your Nuxt config.

nuxt.config.ts

```
export default defineNuxtConfig({
  modules: [
    '@nuxtjs/sitemap',
  ],
})
```

Generate an Agent Skill for this package using [skilld](https://github.com/harlan-zw/skilld):

```
npx skilld add @nuxtjs/sitemap
```

## [Verifying Installation](#verifying-installation)

After you've set up the module with the minimal config, you should be able to visit [`/sitemap.xml`](http://localhost:3000/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 preset are discovered from your

, for dynamic URLs see

.

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

## [Configuration](#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

.

Without a Site URL, your sitemap will use localhost in production.

nuxt.config.ts

```
export default defineNuxtConfig( site: {  url: 'https://example.com',  name: 'My Awesome Website'  }, })
```

.env

```
NUXT_SITE_URL=https://example.comNUXT_SITE_NAME=My Awesome Website
```

For more advanced configurations, check out the

.

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

 module for this.

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

- - If you have dynamic URLs you need to add to the sitemap, you can use a runtime API endpoint. For example, if your generating your site from a CMS.
- - 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

 guide for more information.

## [Next Steps](#next-steps)

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

1. ****- Understand where your sitemap URLs come from
2. ****- Add URLs from a CMS or database
3. ****- Ensure your sitemap follows SEO guidelines

**Using other Nuxt modules?**

- - Automatic locale sitemaps
- - Configure sitemap from markdown frontmatter

**Ready to deploy?** Check out

.

[Edit this page](https://github.com/nuxt-modules/sitemap/edit/main/docs/content/0.getting-started/1.installation.md)

[Markdown For LLMs](https://nuxtseo.com/docs/sitemap/getting-started/installation.md)

Did this page help you?

### Related

On this page

- [Setup Module](#setup-module)
- [Verifying Installation](#verifying-installation)
- [Configuration](#configuration)
- [Next Steps](#next-steps)

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

###

-
-

Modules

-
-
-
-
-
-
-
-
-

###

-
-
-

###

Nuxt

-
-
-
-
-

Vue

-
-
-
-
-
-
-
-

###

-
-
-
-
-
-
-
-
-
-

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