Sitemap Chunking · 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)

### Getting Started

- [Introduction](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [Installation](https://nuxtseo.com/docs/sitemap/getting-started/installation)
- [Data Sources](https://nuxtseo.com/docs/sitemap/getting-started/data-sources)
- [Troubleshooting](https://nuxtseo.com/docs/sitemap/getting-started/troubleshooting)

### Core Concepts

- [Dynamic URL Endpoints](https://nuxtseo.com/docs/sitemap/guides/dynamic-urls)
- [Disabling Indexing](https://nuxtseo.com/docs/sitemap/guides/filtering-urls)
- [Multi Sitemaps](https://nuxtseo.com/docs/sitemap/guides/multi-sitemaps)
- [I18n](https://nuxtseo.com/docs/sitemap/guides/i18n)
- [Nuxt Content](https://nuxtseo.com/docs/sitemap/guides/content)
- [Nuxt Prerendering](https://nuxtseo.com/docs/sitemap/guides/prerendering)
- [Best Practices](https://nuxtseo.com/docs/sitemap/guides/best-practices)
- [Submitting Your Sitemap](https://nuxtseo.com/docs/sitemap/guides/submitting-sitemap)
- [Zero Runtime](https://nuxtseo.com/docs/sitemap/guides/zero-runtime)

### Advanced

- [Lastmod, Priority, and Changefreq](https://nuxtseo.com/docs/sitemap/advanced/loc-data)
- [Images, Videos, News](https://nuxtseo.com/docs/sitemap/advanced/images-videos)
- [Sitemap Performance](https://nuxtseo.com/docs/sitemap/advanced/performance)
- [Sitemap Chunking](https://nuxtseo.com/docs/sitemap/advanced/chunking-sources)
- [Customising the UI](https://nuxtseo.com/docs/sitemap/advanced/customising-ui)

Advanced

# Sitemap Chunking

[Copy for LLMs](https://nuxtseo.com/docs/sitemap/advanced/chunking-sources.md)

## [Introduction](#introduction)

When dealing with large datasets, sitemap sources can be chunked into multiple files to:

- Stay within search engine limits (50MB file size, 50,000 URLs)
- Improve generation performance
- Better manage memory usage

## [Simple Configuration](#simple-configuration)

Enable chunking on any named sitemap with sources:

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      posts: {
        sources: ['/api/posts'],
        chunks: true, // Uses default size of 1000
      }
    }
  }
})
```

This generates:

```
/sitemap_index.xml    # Master index
/posts-0.xml          # First chunk (1-1000)
/posts-1.xml          # Second chunk (1001-2000)
...
```

## [Chunk Size Options](#chunk-size-options)

Configure chunk sizes using different approaches:

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    // Global default
    defaultSitemapsChunkSize: 5000,

    sitemaps: {
      // Using boolean (applies default)
      posts: {
        sources: ['/api/posts'],
        chunks: true,
      },

      // Using number as size
      products: {
        sources: ['/api/products'],
        chunks: 10000,
      },

      // Using explicit chunkSize (highest priority)
      articles: {
        sources: ['/api/articles'],
        chunks: true,
        chunkSize: 2000,
      }
    }
  }
})
```

## [Practical Examples](#practical-examples)

### [E-commerce Site](#e-commerce-site)

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    defaultSitemapsChunkSize: 10000,
    sitemaps: {
      products: {
        sources: ['/api/products/all'],
        chunks: 2000,
      },
      categories: {
        sources: ['/api/categories'],
        chunks: true, // Uses default 10k
      }
    }
  }
})
```

### [Large Content Site](#large-content-site)

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    sitemaps: {
      'blog-posts': {
        sources: ['/api/blog/posts'],
        chunks: 5000,
      },
      'authors': {
        sources: ['/api/authors'],
        chunks: false, // Explicitly disable
      }
    }
  }
})
```

## [Source Implementation](#source-implementation)

Basic endpoint for sitemap sources:

server/api/products/all.ts

```
export default defineEventHandler(async () => {
  const products = await db.products.findAll({
    select: ['id', 'slug', 'updatedAt']
  })

  return products.map(product => ({
    loc: \`/products/${product.slug}\`,
    lastmod: product.updatedAt
  }))
})
```

For large datasets, use caching and streaming:

server/api/products/all.ts

```
export default defineCachedEventHandler(async () => {
  const products = []
  const cursor = db.products.cursor({
    select: ['slug', 'updatedAt']
  })

  for await (const product of cursor) {
    products.push({
      loc: \`/products/${product.slug}\`,
      lastmod: product.updatedAt
    })
  }

  return products
}, {
  maxAge: 60 * 60, // 1 hour cache
  name: 'sitemap-products'
})
```

## [Debugging](#debugging)

Check chunk configuration and performance:

nuxt.config.ts

```
export default defineNuxtConfig({
  sitemap: {
    debug: true,
    sitemaps: {
      products: {
        sources: ['/api/products'],
        chunks: 5000
      }
    }
  }
})
```

Visit `/__sitemap__/debug.json` to see chunk details and generation metrics.

[Edit this page](https://github.com/nuxt-modules/sitemap/edit/main/docs/content/2.advanced/3.chunking-sources.md)

[Markdown For LLMs](https://nuxtseo.com/docs/sitemap/advanced/chunking-sources.md)

Did this page help you?

### Related

[Multi Sitemaps](https://nuxtseo.com/docs/sitemap/guides/multi-sitemaps) [Sitemap Performance](https://nuxtseo.com/docs/sitemap/advanced/performance) [Data Sources](https://nuxtseo.com/docs/sitemap/getting-started/data-sources)

[Sitemap Performance Use the default cache engine to keep your sitemaps fast.](https://nuxtseo.com/docs/sitemap/advanced/performance) [Customising the UI Change the look and feel of your sitemap.](https://nuxtseo.com/docs/sitemap/advanced/customising-ui)

On this page

- [Introduction](#introduction)
- [Simple Configuration](#simple-configuration)
- [Chunk Size Options](#chunk-size-options)
- [Practical Examples](#practical-examples)
- [Source Implementation](#source-implementation)
- [Debugging](#debugging)

[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)