For the SEO optimization, it’s necessary to support robots.txt and sitemap so that search engineer can know your website easily. Next.js does not support robots.txt and sitemap.xml so that we need to implement by ourselves.
pages/folder. And browser accesses
http://<your-domain>/sitemap.xml, Next.js will route the request to sitemap.xml.js. Now you can return whatever content your want in sitemap.xml.
pagesfolder with below content.
out/folder. So you can write a script to generate robots.txt and sitemap.xml under
out/. I believe I don’t need to explain how to do that : ).