Next.js Discord

Discord Forum

Sitemap not updating when a new article is published

Unanswered
Nile Crocodile posted this in #help-forum
Open in Discord
Nile CrocodileOP
I use Sanity as my CMS and I have a couple of sitemaps that read data from it in order to construct the sitemap. I have export const dynamic = 'force-dynamic' in the file, yet I have to redeploy my app whenever I publish a new article for it to show up in my sitemap.

The getPostsForSitemap() function in the file looks like

export function getPostsForSitemap() {
  return client.fetch<SitemapContent[]>(
    `*[_type == 'post' && defined(slug.current)]{
      _id,
      _updatedAt,
      publishedAt,
      "slug": slug.current,
    }`,
    {},
    { token, perspective: 'published' },
  )
}


So I'm not really caching anything (to my knowledge), so I am kind of lost why it wouldn't update.

0 Replies