We are trying to add a /sitemap.xml to our (mostly) statically generated next.js/Vercel page.
While there are many tutorials and many different solutions, I would prefer the least "invasive" approach inside the next.js platform.
Generating the sitemap.xml during the build process seems odd to me, as the page infrastructure already provides SSG /Static Site Generation to do things at build-time. The problem with such a standard SSG "page" is that I would need hardcoded routes in the _document so that it renders no page skeletion for the sitemap, which seems unintuitive and error-prone.
The other option that crossed my mind, a custom /pages/api/sitemap endpoint with a redirect from /sitemap.xml to that location, also seems wrong, since the /pages/api doesn't seem to permit SSG (which is understandable in the context of an API but would here cause unnecessary server load).
Are there any other options?