In this article, we will show you how to generate a sitemap for your Next.js application on Vercel.
The Next.js App Router has built in support for generating sitemaps. You can use the sitemap.(js|ts) file convention to programmatically generate a sitemap by exporting a default function that returns an array of URLs. If using TypeScript, a Sitemap type is available.
This will generate the following sitemap.xml file during next build: