What nextjs-sitemap does
nextjs-sitemap is an npm package for Next.js that writes a sitemap.xml at build time. It walks the pages directory and adds every static route automatically, then applies the domain and locale settings passed to configureSitemap. Routes can be removed by pattern, and per-path options set priority and changefreq. The output follows the sitemap format Google documents.
Dynamic routes must be declared in the configuration rather than discovered from the folder. When the url count passes 50000, the output is split into several sitemaps. Localization is handled through a locales option on each domain entry. The generated file can be gzipped, and the .gz extension signals to crawlers that the sitemap is compressed.
Key features
- Static route discovery
- Every static route under the pages folder is added to the sitemap without manual listing.
- Dynamic route declarations
- Dynamic routes are declared in the config so parameterised urls appear in the generated output.
- Localization per domain
- A locales option on each domain entry produces entries for each language the site serves.
- Multiple sitemaps over 50000
- When the url count exceeds 50000, the output is split into several sitemap files.
- exportPathMap reading
- Setting nextConfigPath reads exportPathMap values from next.config.js and uses them.
- Path exclusion patterns
- An exclude array removes routes such as /admin/* from the generated sitemap.
- Per-path priority and changefreq
- pagesConfig sets priority and changefreq for route groups such as /projects/*.
- Gzip output
- The sitemap can be gzipped, and the .gz extension marks the compressed file.
- Sitemap methods and options
- Documented methods and options let callers adjust how the sitemap file is produced.
How it works
- Install the package with npm or Yarn in the project root.
- Call configureSitemap with domains, a default locale and http setting.
- Static routes under the pages folder are collected and written to the sitemap.
- Declare dynamic routes in the config since the file tree does not describe them.
- Add exclude patterns and pagesConfig entries for priority and changefreq.
- Generate the file at build time and optionally gzip it.
Plans and pricing
The package is published on npm under the ISC licence at no cost and the repository prints no pricing.
Integrations and platforms
Works with
- Next.js
- npm
- Yarn
Available as
- Web
Repository facts
- RepositorySergeyMyssak/nextjs-sitemap
- LanguageTypeScript
- Stars122
- Forks5
- Created2020-06-28
- Last commit2026-11-22
- Open issues8
- nextjs
- sitemap
- sitemap-builder
- sitemap-generation
- sitemap-generator
- sitemap-xml
Services and details
Does SEO work itself
Yes
No information yet on keyword research, content optimization, writes content with AI, technical audits, rank tracking, backlinks and link building, local SEO, AI search visibility, free plan or free tools, free trial, API or MCP server, WordPress plugin, browser extension, built for agencies. The website did not say; check with the vendor.
About the company
- Company SergeyMyssak
- Website: github.com/SergeyMyssak/nextjs-sitemap
Listing compiled from public sources and the product's own website. Last updated 2026-11-12. Report a correction or request removal. Back to GitHub repos.