In this post, we will explore how to add a dynamic sitemap to a Next.js website using the app directory. By the end of this post, you will have a fully functional dynamic sitemap for your Next.js website.
I think there is already a package next sitemap that can do the job
Yeah, it's called next-sitemap, but you don't really need it in this case.