NextJS Runtime Sitemap Generator
Zero-touch sitemap generator for NextJS apps (but this one generates at runtime!)

🌍 next-runtime-sitemap
Most sitemap generators for Next.js assume you're working with a fully static site — or at least one that fits nicely into a "build everything up front" workflow. But modern Next.js apps don’t always work like that.
There's a couple reasons for this.
- Static params don’t fit every app model
Not every app has clean, SEO-optimized APIs for listing content. On The Medley, for example, our user data is exposed through a geolocalized search API—not an ideal fit for generating a sitemap. Trying to shoehorn that API intogenerateStaticParams
felt like forcing a square peg into a round hole. Many apps face similar mismatches between their internal data shape and what’s needed for static sitemap generation. - Builds don’t always track content changes
Most sites are rebuilt when features change—not when content is added. But SEO-critical content like user profiles or blog posts can be created at any time. Without scheduled chore tasks or redeploys, a statically generated sitemap can quickly fall out of date and miss valuable new pages. - Build-time sitemaps don’t play well with multi-environment setups
Static sitemaps generated at build time are tied to the data available in that environment. That’s fine for production, but what about staging, beta, or preview environments? Testing sitemap logic in non-prod setups becomes impossible unless you replicate prod data across environments—something many teams avoid for good reasons. Platforms like Vercel encourage per-environment builds, but in practice, many production setups don’t work that way.
Maybe you’re mixing App Router and Pages Router.
Maybe you’re using revalidate
to keep pages fresh after deployment.
Or maybe you just don’t want to run another build-time crawler script.
That’s exactly why I built next-runtime-sitemap
.
Instead of trying to predict your site’s structure at build time, it reads the actual .next
filesystem at runtime — so it always knows what pages exist right now. That means:
- ✅ No need to manually list dynamic params
- ✅ No build step required
- ✅ Works with static, dynamic (with revalidation), and hybrid routes
- ✅ Supports both
pages/
andapp/
directories - ❌ Not for serverless — this needs access to the deployed filesystem
It's perfect for self-hosted or Dockerized Next.js apps where routes can evolve over time, and where your sitemap should match what's actually deployed, not just what your build script guessed.
If you're deploying to Vercel or using fully static generation, use next-dynamic-sitemap
instead. But if you're running a real server and want a sitemap that's always accurate without any extra work — this one's for you.