Stale dynamic sitemap
Unanswered
Mini Rex posted this in #help-forum
Mini RexOP
I am trying to create dynamic sitemap but after first time it is not updating the sitemap can anyone help me fix this issue?
code:-https://github.com/pradeep800/striver-sheet-webiste/blob/main/app/sitemap.ts
code:-https://github.com/pradeep800/striver-sheet-webiste/blob/main/app/sitemap.ts
46 Replies
Mini RexOP
Can anyone please help i am struggling with issue for while
Philippine Crocodile
What's the issue? What is it returning?
Mini RexOP
https://striversheet.pradeepbisht.com/sitemap.xml it doesn't change my sitemap when i am changing my user name
it only updating it when i am redeploying it
Philippine Crocodile
That is how it works. Sitemap only generates when the next build is ran
Mini RexOP
how can i genrate dynamic sitemap then?
what will seo know that his name is changed ?
Philippine Crocodile
When do you want to generate a sitemap?
Mini RexOP
i want to generate it whenever i am requesting
Philippine Crocodile
I personally like generating a sitemap once a day for my projects
Mini RexOP
if i send request it should be changed
how do you do that?
Philippine Crocodile
I haven't tried this. But you should be able to run the sitemap.ts/js file manually and swap out the sitemap.xml in the public folder
I use a custom service for doing this daily, so you can do that too. There is also https://pro-sitemaps.com/
Mini RexOP
ohh okay can you help me one more problem?
Philippine Crocodile
what's up
Mini RexOP
whenever i am trying to go to /sheet it is automatically updating it to /Sheet that causing problem in next js 13 why
you can see in this video
Philippine Crocodile
I can't find a good way to handle that
You could redirect /Sheet to /sheet
Mini RexOP
okay do you know why this is happening?
becaus of this [username]
Philippine Crocodile
{
source: '/Sheet',
destination: '/sheet',
permanent: true,
},
Mini RexOP
where should i do that
which file
i am using next 13
Philippine Crocodile
next.config.js
async redirects() {
return [
{
source: '/legal/:page',
destination: '/docs/:page',
permanent: true,
},
];
},
add that
Mini RexOP
okay
can you give me documentation link of this i really like to read it
Philippine Crocodile
oops but /Sheet to /sheet
Mini RexOP
?
thank you
Philippine Crocodile
async redirects() {
return [
{
source: '/Sheet',
destination: '/sheet',
permanent: true,
},
];
},
should work
Mini RexOP
do you know why this is happening
why it is automatically adding it to url
anything to do with [username] and sheet collision?
Philippine Crocodile
??
what do you mean
Mini RexOP
you can see in video when i am going to /sheet it is automatically redirectly me to /Sheet why it is happening
when i am clicking to link it is not redirecting me to /sheet (that mean correctly)
Philippine Crocodile
check private messages