Jan Omacka
Jan Omacka

Reputation: 1840

How to generate sitemap with react router

I'm trying to figure out how to dynamically generate sitemap in reactJS server side (express) web app. I'm using react router.

Upvotes: 35

Views: 75345

Answers (2)

yash kothari
yash kothari

Reputation: 91

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

  1. sitemap.xml
  2. rss.feed
  3. robots.txt
  4. humans.txt

That too with preserving the behaviour of ReactJS.

Upvotes: 8

samcorcos
samcorcos

Reputation: 2478

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?

Upvotes: 15

Related Questions