Help with dynamic sitemap
Unanswered
Bald Eagle posted this in #help-forum
Bald EagleOP
I coded my sitemap as sitemap.ts
It has a static sitemap where i hardcoded it.
Then added more sitemap dynamically fetching from contentful.
when i visit localhost:/sitemap.xml it works fine
But site.com/sitemap.xml is not showing a new blog i posted.
It has a static sitemap where i hardcoded it.
Then added more sitemap dynamically fetching from contentful.
when i visit localhost:/sitemap.xml it works fine
But site.com/sitemap.xml is not showing a new blog i posted.
2 Replies
@Bald Eagle I coded my sitemap as sitemap.ts
It has a static sitemap where i hardcoded it.
Then added more sitemap dynamically fetching from contentful.
when i visit localhost:/sitemap.xml it works fine
But site.com/sitemap.xml is not showing a new blog i posted.
are you generating the sitemap with
it is static generated at build time. If you want dynamic sitemap, you could create it with
app/sitemap.ts?it is static generated at build time. If you want dynamic sitemap, you could create it with
app/sitemap.xml/route.ts and set the content-type of response to application/xml@Ray are you generating the sitemap with `app/sitemap.ts`?
it is static generated at build time. If you want dynamic sitemap, you could create it with `app/sitemap.xml/route.ts` and set the content-type of response to application/xml
i mean, sitemap.ts is just a fancy route hander, and you can use most of the same things like
https://nextjs.org/docs/app/building-your-application/optimizing/metadata#dynamic-metadata
export const revalidate = 0 and revalidatePath iirchttps://nextjs.org/docs/app/building-your-application/optimizing/metadata#dynamic-metadata