I'm trying to figure out how to dynamically generate sitemap in reactJS server side (express) web app. I'm using react router.
Asked
Active
Viewed 5.8k times
34
-
How detailed do you need your sitemap to be? And I assume XML is fine? – samcorcos Sep 13 '16 at 02:31
2 Answers
16
For simple ReactJS sitemap integration with React Router, you should check out the react-router-sitemap package.
It's fairly configurable as well, as you can see in the docs, so if you need to include change frequency or things like that, you should be able to do it no problem.
Or were you looking for a way to implement one yourself?

samcorcos
- 2,330
- 4
- 27
- 40
-
Does sitemap.xml created with react-router match our react-router-dom paths in router?Please answer anyone. – Goran_Ilic_Ilke Sep 28 '21 at 07:00
-
React Router Sitemap has not been updated in over 5 years, doesn't work with latest react version – Temba Aug 22 '23 at 20:29
7
If your site frequently changes, you need to dynamically create the sitemap. I was stuck here and found this effective solution, which can even generate a real time sitemap by calling API for my website in ReactJS, using NextJs. dynamic Sitemap Steps
You can do this by creating most of the public files like
- sitemap.xml
- rss.feed
- robots.txt
- humans.txt
That too with preserving the behaviour of ReactJS.

Vivek Ghanchi
- 232
- 4
- 16

yash kothari
- 81
- 1
- 2
- 8
-
1Thank you for your help, I used the code of this blog in my project. It helped me a lot. – Lancer.Yan Nov 22 '20 at 07:10