Replies: 3 comments 1 reply
-
|
That’s a very solid proposal — it makes sense since the Next.js compiler already has full awareness of all static routes and SSG output. Automating sitemap generation at build time could easily be integrated as a post-build step, similar to how next export works. Maybe this could even be an optional config like: // next.config.js so teams that prefer custom sitemap logic can still opt out. |
Beta Was this translation helpful? Give feedback.
-
|
This is surely a time saving feature to have |
Beta Was this translation helpful? Give feedback.
-
|
@nextjs-bot We need it! I wish to get your reply. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Next.js add a config to generate sitemap automatically based on generating static pages
Non-Goals
No response
Background
Most of websites with nextjs need to write similar sitemap.ts togenerate their sitemaps. The sitemaps is truly file-based. If I write it in a fixed form, I will get trouble in updating. But if I use dynamic sitemap generate, I need to make a lot of complicated judgements, such as Route Groups and static-generate dynamic route. However, in reality, these things are already determined during the construction process, and the compiler is completely clear. The compiler can easily obtain all the generated SSG information, and based on this, a sitemap can be easily generated.
Proposal
The compiler should automatically summarize the ssg information after the build process and generate the sitemap based on it. Additionally, if the user has additional configurations, corresponding processing should be carried out, such as ignoring a certain route.
Beta Was this translation helpful? Give feedback.
All reactions