Next.js Discord

Discord Forum

Question about sitemaps

Answered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
Is it possible to generate a static sitemap? Because as far as I understood, the sitemap is generated during the runtime... is that right or am I missing something?
Answered by B33fb0n3
you can create a [sitemap.xml](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap) in the root of your app directory. Then just write the stuff down that you want to have in there.
View full answer

3 Replies

Answer
@B33fb0n3 you can create a [sitemap.xml](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap) in the root of your app directory. Then just write the stuff down that you want to have in there.
Masai LionOP
is that a good practice to fetch data from my database and then generate it dinamically? if so, will this data be generated everytime when I get a request to this file?
@Masai Lion is that a good practice to fetch data from my database and then generate it dinamically? if so, will this data be generated everytime when I get a request to this file?
iirc it will be generated evertime you visit it when it's not cached via your domain. Because of that you want to cache your db fetch