---
title: "Multi Sitemaps"
description: "Generate multiple sitemaps for different sections of your site."
canonical_url: "https://nuxtseo.com/docs/sitemap/guides/multi-sitemaps"
last_updated: "2026-05-14T02:23:21.154Z"
---

## Introduction

By default, the module generates a single `/sitemap.xml` file, which works perfectly for most websites.

For larger sites with thousands of URLs, multiple sitemaps offer several benefits:

- Easier debugging and management
- More efficient search engine crawling
- Better organization of content types

## Enabling Multiple Sitemaps

You can enable multiple sitemaps using the `sitemaps` option in two ways:

1. **Manual Chunking** (`object`): Best for sites with clear content types (pages, posts, etc) or fewer than 1000 URLs
2. **Automatic Chunking** (`true`): Best for sites with more than 1000 URLs without clear content types

<code-group>

```ts [Manual Chunking]
export default defineNuxtConfig({
  sitemap: {
    // manually chunk into multiple sitemaps
    sitemaps: {
      posts: {
        include: [
          '/blog/**',
        ],
        // example: give blog posts slightly higher priority (this is optional)
        defaults: { priority: 0.7 },
      },
      pages: {
        exclude: [
          '/blog/**',
        ]
      },
    },
  },
})
```

```ts [Automatic Chunking]
export default defineNuxtConfig({
  sitemap: {
    sitemaps: true,
    // modify the chunk size if you need
    defaultSitemapsChunkSize: 2000 // default 1000
  },
})
```

</code-group>

### Customizing Sitemap URLs

By default, all multi-sitemaps are served under the `/__sitemap__/` prefix. You can customize this behavior to create cleaner URLs:

```ts
export default defineNuxtConfig({
  sitemap: {
    sitemapsPathPrefix: '/', // or false
    sitemaps: {
      // will be available at /sitemap-foo.xml
      'sitemap-foo': {
        // ...
      }
    }
  }
})
```

## Manual Chunking

Manual chunking gives you complete control over how your URLs are distributed across sitemaps. This approach is ideal when you have distinct content types or specific organizational needs.

### Setting Default Values

You can provide default values for URLs within each sitemap using the `defaults` option:

```ts
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      posts: {
        // posts low priority
        defaults: { priority: 0.7 },
      },
    },
  },
})
```

### Extending App Sources

When you already have all URLs in your single sitemap but want to split them into separate sitemaps, you can extend existing [app sources](/docs/sitemap/getting-started/data-sources) and apply filters.

Available options:

- `includeAppSources`: Include URLs from automatic app sources
- `include`: Array of glob patterns to include
- `exclude`: Array of glob patterns to exclude

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      pages: {
        // extend the nuxt:pages app source
        includeAppSources: true,
        // filter the URLs to only include pages
        exclude: ['/blog/**'],
      },
      posts: {
        // extend the nuxt:pages app source
        includeAppSources: true,
        // filter the URLs to only include pages
        include: ['/blog/**'],
      },
    },
  },
})
```

#### Using the `_sitemap` Key

When using global sources and need to direct specific URLs to particular sitemaps, use the `_sitemap` key:

<code-group>

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  sitemap: {
    sources: [
      '/api/sitemap-urls'
    ],
    sitemaps: {
      pages: {
        includeAppSources: true,
        exclude: ['/**']
        // ...
      },
    },
  },
})
```

```ts [server/api/sitemap-urls.ts]
export default defineSitemapEventHandler(() => {
  return [
    {
      loc: '/about-us',
      // will end up in the pages sitemap
      _sitemap: 'pages',
    }
  ]
})
```

</code-group>

### Managing Custom Sources

For sitemaps that need to fetch URLs from endpoints, you have two options:

- `urls`: Static URLs to include in the sitemap (avoid for large URL sets)
- `sources`: Endpoints to fetch [dynamic URLs](/docs/sitemap/guides/dynamic-urls) from (JSON or XML)

```ts
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      posts: {
        urls() {
          // resolved when the sitemap is shown
          return ['/foo', '/bar']
        },
        sources: [
          '/api/sitemap-urls'
        ]
      },
    },
  },
})
```

### Chunking Large Sources

When you have sources that return a large number of URLs, you can enable chunking to split them into multiple XML files:

```ts
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      posts: {
        sources: ['/api/posts'], // returns 10,000 posts
        chunks: true, // Enable chunking with default size (1000)
      },
      products: {
        sources: ['/api/products'], // returns 50,000 products
        chunks: 5000, // Chunk into files with 5000 URLs each
      },
      articles: {
        sources: ['/api/articles'],
        chunks: true,
        chunkSize: 2000, // Alternative way to specify chunk size
      }
    }
  },
})
```

This will generate:

- `/sitemap_index.xml` - Lists all sitemaps including chunks
- `/posts-0.xml` - First 1000 posts
- `/posts-1.xml` - Next 1000 posts
- `/products-0.xml` - First 5000 products
- `/products-1.xml` - Next 5000 products
- etc.

### Linking External Sitemaps

Use the special `index` key to add external sitemaps to your sitemap index:

```ts
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      // generated sitemaps
      posts: {
        // ...
      },
      pages: {
        // ...
      },
      // extending the index sitemap with an external sitemap
      index: [
        { sitemap: 'https://www.google.com/sitemap-pages.xml' }
      ]
    }
  }
})
```

## Automatic Chunking

Automatic chunking divides your sitemap into multiple files based on URL count. This feature:

- Uses numbered naming convention (`0.xml`, `1.xml`, etc.)
- Chunks based on `defaultSitemapsChunkSize` (default: 1000 URLs per sitemap)
- Should be avoided for sites with fewer than 1000 URLs

```ts
export default defineNuxtConfig({
  sitemap: {
    // automatically chunk into multiple sitemaps
    sitemaps: true,
    // optionally customize chunk size
    defaultSitemapsChunkSize: 2000 // default: 1000
  },
})
```
