next-sitemap

Generate XML sitemaps and robots.txt files for static, pre-rendered and server-rendered Next.js sites.

github.com/iamvishnusankar/next-sitemap
next-sitemap homepage screenshot

About next-sitemap

next-sitemap generates XML sitemaps and robots.txt for Next.js sites, including static, pre-rendered, dynamic, and server-side pages. It runs as a postbuild step using a config file that defines the site URL and output options.

By default it creates an index sitemap, can split large sitemaps into multiple files with the sitemapSize setting, and supports path exclusion, transform functions, and custom config files. Use requires a Next.js project with a config file in the project root.

Key features

  • Generate sitemaps and robots.txt for Next.js pages
  • Create index sitemap linking generated sitemap files
  • Split large sitemaps using configurable sitemapSize value
  • Exclude paths with wildcard patterns or transform function
  • Support custom config file path via --config flag
  • Load environment variables from .env files by default
Best for: Developers maintaining Next.js sites who need generated sitemaps and robots.txt after each build.
Good for
  • Covers static, pre-rendered, dynamic, and server-side pages
  • Splits large sitemaps into multiple files with index file
  • Supports wildcard excludes and per-path transform function
Watch out for
  • Requires a Next.js project with a config file and postbuild script
  • pnpm projects need an extra .npmrc setting to run postbuild

next-sitemap at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 5, 2026 · Online when checked
Listed
Oct 5, 2026

next-sitemap alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in SEO & Web Analytics

Well-known listings from the same topic.

All 211

next-sitemap FAQ

How do I generate sitemaps after building?
Add "postbuild": "next-sitemap" to package scripts and run it after "next build" with a next-sitemap.config.js file in the project root.
Can I use a different config file?
Yes. Pass the path with --config, for example "next-sitemap --config awesome.config.js".
How do I split a large sitemap?
Set sitemapSize in the config; when URLs exceed that number, files like sitemap-0.xml, sitemap-1.xml and an index sitemap.xml are created.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing