How to generate sitemap.xml with Next.js build-in server and Typescript?
Published in
1 min readJan 15, 2020
What is sitemap?
In this tutorial, I assume you already know what is sitemap and why do we need sitemap. If you want to know more about sitemap, I recommend you to check the following websites:
Use Next.js API Routes to generate sitemap.xml
API routes provide a straightforward solution to build your API with Next.js. Any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint instead of a page.
We use sitemap package to generate sitemap.xml in server side. Firstly, let us install it.
yarn add sitemap
Check the solution in below article link. It is integrated with gitlab codes snippet.