Looking for Help with a cached sitemap. Next.js + Docker
Unanswered
Rex posted this in #help-forum
RexOP
I'm trying to update my sitemap.xml but it appears to be cached somehow as changes aren't reflected on my live site when I'm updating with a new version.
I use an SEO tool generated sitemap.xml file, which is placed in the app directory. Pushed to Github and then the site is rebuilt on my Caprover server.
I've tested it in various browsers with the same result, so it's not the browser cache. Where could this cache issue be?
I use an SEO tool generated sitemap.xml file, which is placed in the app directory. Pushed to Github and then the site is rebuilt on my Caprover server.
I've tested it in various browsers with the same result, so it's not the browser cache. Where could this cache issue be?
28 Replies
how are you making your sitemap.xml? (as im assuming not the new official method)
RexOP
What's the new official method? The docs say
I'm literally taking a sitemap.xml file (created with Screaming Frog) and adding it to the app directory.
Add or generate a sitemap.xml file that matches the Sitemaps XML format in the root of app directoryI'm literally taking a sitemap.xml file (created with Screaming Frog) and adding it to the app directory.
so you make
app/sitemap.xml and access on /sitemap.xml and it 404s?RexOP
No, it's not updating when a new sitemap.xml is added.
so, you change the file and run
npm run build and it doesn't update?RexOP
Exactly, it must be cached somehow.
o.O
does it update when you run the command locally? (
npm run build && npm run start)RexOP
I would expect so, let me check..
as it could be your provider caching instead ðŸ˜
and if that doesn't work, make sure you are latest nextjs and other deps version
RexOP
Ahh, well that's weird...
It's not updating locally, pardon my language but WTF..
How is the local build showing a file that no longer exists
browser caching?
RexOP
1 sec..
if you try access in private mode/ new browser... is it still cached?
RexOP
Yep
RexOP
If I delete the .next folder, it's still there. If I access it in Incognito it's still there, if I disable caching in dev tools in the Network tab, it's still there
unless the file isn't updated, there has to be very weird caching (nextjs doesn't cache outside that file)
RexOP
I honestly thought it would just be a cache in prod, I don't see how this file can still be showing.
http://localhost:3000/sitemap.xml
<!-- Generated by Screaming Frog SEO Spider 16.6 -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- Generated by Screaming Frog SEO Spider 16.6 -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
sitemap.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
RexOP
I've updated next to the latest version, cleared all history and cache in the browser and still seeing this old sitemap. I think I'll have to raise a bug.
i just checked it on a codesandbox, and it does indeed not change??? (after build once)