Setting force-dynamic in layout.tsx makes next-sitemap generate an empty sitemap.xml
Unanswered
Muscovy Duck posted this in #help-forum
Muscovy DuckOP
To solve an issue with Google Search Console, I had to force my site cache to be no-cache.
Since I added the
Any idea what might be causing this?
Here is the sitemap.xml when it is generated properly:
Since I added the
export const dynamic = 'force-dynamic'
directive in my layout.tsx
, when the next-sitemap
builds it generates an empty sitemap.xml:<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</sitemapindex>
Any idea what might be causing this?
Here is the sitemap.xml when it is generated properly:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://XXX.com/sitemap-0.xml</loc></sitemap>
</sitemapindex>