Next.js Discord

Discord Forum

Dynamic sitemap

Answered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Does anyone know of a way to dynamically update the sitemap, using app router? Right now i have to rebuild every time i make a change to a page slug for instance. I would prefer not having to resort to webhooks and rebuild just for the sake of the sitemap.
Thanks!
Answered by riský
Are you using the latest version? As they made it so you can make it dynamic, and as a result of assume you can revalidate it too...
View full answer

8 Replies

Are you using the latest version? As they made it so you can make it dynamic, and as a result of assume you can revalidate it too...
Answer
Spectacled bearOP
Im using next v13.5.3. I can generate one from dynamic data, but revalidating does not seem to do anything. I still have to run another build for changes to take effect.
Spectacled bearOP
I dont see anything specifically addressing this, but i can give it a try
Spectacled bearOP
Oh that worked! Thanks!
@Spectacled bear Oh that worked! Thanks!
Yay! I don't remember when it was fixed, but I remember going into canary to fix it... And I then know that there has been a stable now... So for the future I would recommend using latest version before wondering about bugs... 🙂
Spectacled bearOP
Makes sense. I was only one minor version behind and didnt see anything in the release notes addressing this, but you're right. I should have checked that first.
Also, from what I understand with nextjs, they sometimes add more then it's name says... (But that is rare I believe)