---
title: "How to Generate a Sitemap in Nuxt"
description: "Generate an XML sitemap in Nuxt with the Sitemap module or a static file, then submit it to help Google discover URLs."
canonical_url: "https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/sitemaps"
last_updated: "2026-10-08"
---

> Index of every page on this site: [llms.txt](https://nuxtseo.com/llms.txt)

::key-takeaways
- Sitemaps limited to 50,000 URLs or 50MB. Use sitemap index for larger sites
- Skip `changefreq` and `priority`. Google ignores them, use accurate `lastmod` dates alongside each URL
- Nuxt Sitemap module auto-generates from pages/ and handles large sites
::

This guide covers sitemap strategy and configuration. For module installation and API reference, see the [Nuxt Sitemap documentation](https://nuxtseo.com/docs/sitemap/getting-started/introduction).

The `sitemap.xml` file helps search engines discover your pages. Google considers sites "small" if they have [500 pages or fewer](https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview). You likely need a sitemap if you exceed this, have new sites with few backlinks, or update content frequently. For new sites, pair your sitemap with a solid [internal linking structure](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/internal-linking) and a [pre-launch warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup) strategy to accelerate discovery.

## Static Sitemap

For a small set of stable URLs, create a static sitemap in your public directory:

```dir
public/
  sitemap.xml
```

Add your URLs with proper formatting:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://mysite.com/</loc>
    <lastmod>2024-11-03</lastmod>
  </url>
  <url>
    <loc>https://mysite.com/about</loc>
    <lastmod>2024-12-10</lastmod>
  </url>
</urlset>
```

Sitemaps are limited to [50,000 URLs or 50MB uncompressed](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap). Use UTF-8 encoding and absolute URLs only.

## Dynamic Generation

For frequently changing content, use the [Sitemap module dynamic URL sources](https://nuxtseo.com/docs/sitemap/guides/dynamic-urls). Supply canonical URLs from your app's data source.

Avoid interpolating arbitrary paths into XML: characters such as `&` require XML escaping. The custom builder is omitted here; the module handles serialization.

## Automatic Generation

Nuxt generates sitemaps automatically with the Sitemap module:

::module-card{slug="sitemap"}
::

Install and configure:

```bash
pnpm add -D @nuxtjs/sitemap
```

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['@nuxtjs/sitemap'],
  site: {
    url: 'https://mysite.com'
  }
})
```

This creates a sitemap from your routes automatically. For static sites, it's generated at build time. For dynamic sites, it's generated on request.

The module handles:

- Route discovery from `pages/` directory
- Dynamic routes with route rules
- Sitemap indexes for large sites
- Image and video sitemaps
- News sitemaps
- Multi-language sitemaps

For full configuration options, see the [Sitemap module docs](https://nuxtseo.com/docs/sitemap/getting-started/introduction).

## XML Sitemap Tags

A basic sitemap uses these elements:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://mysite.com/page</loc>
    <lastmod>2024-11-03</lastmod>
  </url>
</urlset>
```

| Tag                         | Status      | Google Uses?                                                                                                        |
| --------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| `<loc>`{lang="html"}        | Required    | Yes, the page URL                                                                                                   |
| `<lastmod>`{lang="html"}    | Recommended | Yes, [if consistently accurate](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap) |
| `<changefreq>`{lang="html"} | Skip        | [No, Google ignores this](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)       |
| `<priority>`{lang="html"}   | Skip        | [No, Google ignores this](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)       |

Google only uses `<lastmod>`{lang="html"} [if it's consistently and verifiably accurate](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap), meaning it can compare the date against the page's actual last modification. Update it when you change main content, structured data, or links: a copyright year bump or a typo fix doesn't count. Sitemaps that fake the date lose Google's trust in the whole file.

## IndexNow: Push-Based Discovery

[IndexNow](https://www.indexnow.org/documentation) notifies participating engines that a URL changed. A successful submission does not guarantee crawling or indexing.

A sitemap endpoint does not establish that IndexNow submissions are configured. See the [IndexNow guide](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/indexnow) for the separate key and submission setup.

## Sitemap Index for Large Sites

If you exceed 50,000 URLs or 50MB, [split your sitemap into multiple files](https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps):

```xml [sitemap-index.xml]
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://mysite.com/sitemap-products.xml</loc>
    <lastmod>2024-11-03</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://mysite.com/sitemap-blog.xml</loc>
    <lastmod>2024-12-10</lastmod>
  </sitemap>
</sitemapindex>
```

Submit the index file to [Google Search Console](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/search-console). Submission helps discovery but does not guarantee that Google fetches every child sitemap or indexes every URL.

The Sitemap module handles this automatically when your site exceeds limits.

## Specialized Sitemaps

### News Sitemap

News publishers should create [separate news sitemaps](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap) with articles from the last 2 days:

```xml [sitemap-news.xml]
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
    <loc>https://mysite.com/article</loc>
    <news:news>
      <news:publication>
        <news:name>Site Name</news:name>
        <news:language>en</news:language>
      </news:publication>
      <news:publication_date>2024-12-10T12:00:00+00:00</news:publication_date>
      <news:title>Article Title</news:title>
    </news:news>
  </url>
</urlset>
```

Remove articles older than 2 days to keep the sitemap fresh; don't create new sitemaps daily, update the existing one.

### Image Sitemap

For galleries or image-heavy sites, add image metadata:

```xml [sitemap.xml]
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  <url>
    <loc>https://mysite.com/page</loc>
    <image:image>
      <image:loc>https://mysite.com/image.jpg</image:loc>
    </image:image>
  </url>
</urlset>
```

[Image sitemaps help Google find images loaded via JavaScript](https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps) or not directly linked in HTML.

## Submit to Google Search Console

After generating your sitemap, [submit it to Google Search Console](https://support.google.com/webmasters/answer/7451001):

1. [Verify site ownership](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/search-console) (DNS, HTML file upload, or Google Analytics)
2. Navigate to **Sitemaps** under **Indexing**
3. Enter your sitemap URL: `https://mysite.com/sitemap.xml`{lang="bash"}
4. Click **Submit**

Google processes the sitemap and reports status:

- **Success**: Google fetched and processed the sitemap; this does not prove every URL is indexed
- Use the report's status details to check processing
- **Couldn't fetch**: inspect the reported fetch error and server response

Check the Sitemaps report for coverage stats, indexing errors, and discovered URLs.

In [October 2026 conference reporting](https://www.seroundtable.com/google-crawling-indexing-serving-data-42225.html), typical sitemap processing took about 24 hours. Slow cases took up to 14 days or never completed because of quality.

Processing the file does not mean its URLs are indexed. See [Google Search timelines](https://nuxtseo.com/learn-seo/google-search-timelines) before treating a wait as a failure.

### Before Submitting

Validate your sitemap:

- XML syntax is valid (use an [online validator](https://www.xml-sitemaps.com/validate-xml-sitemap.html))
- All URLs return 200 status (not 404 or 500)
- URLs match [canonical URLs](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/canonical-urls) exactly
- `<lastmod>`{lang="html"} dates are accurate
- File uses UTF-8 encoding

### Alternative Submission

Reference your sitemap in `robots.txt`{lang="bash"}:

```txt [public/robots.txt]
User-agent: *
Allow: /

Sitemap: https://mysite.com/sitemap.xml
```

Google discovers this automatically when [crawling your robots.txt](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/robots-txt).

### Troubleshooting "Couldn't Fetch"

If a sitemap loads in your browser but Search Console reports a fetch error, inspect the report details and server logs. Confirm the exact URL returns valid XML and does not require authentication.

Check any child sitemap named in the report. A browser request does not prove Google received the same response. The [Sitemaps report documentation](https://support.google.com/webmasters/answer/7451001) explains the reported errors.

Some failures are transient. Recheck after the next fetch. Deleting, renaming, or resubmitting a sitemap does not guarantee an immediate refetch.

## Checklist

::checklist{#nuxt-sitemaps}
- Sitemap includes every indexable URL, none blocked by `robots.txt` or `noindex`
- `<lastmod>`{lang="html"} dates are accurate, not blanket-set on every deploy
- Sitemap stays under 50,000 URLs and 50MB, split into an index if not
- Sitemap submitted in Google Search Console and referenced in `robots.txt`
- Large or multi-locale sites use the Sitemap module's automatic indexing
::

## Sitemap

See the full [sitemap](https://nuxtseo.com/sitemap.md) for all pages.
