geek glance
geek glance

Reputation: 111

React sitemap.xml

I have a sitemap.xml file I want to show it when users hit www.mysite.com/sitemap.xml route. How can I do that? I am using react and react-router-dom.

Upvotes: 0

Views: 8057

Answers (2)

Omkar Rajam
Omkar Rajam

Reputation: 791

If you already have a sitemap.xml file ready with you, just put it under public directory. Anything under public directory can be directly opened by putting its path after domain url (even if you are using react-router-dom). So, sitemap.xml put under public directory will be available at www.mysite.com/sitemap.xml in your case.

enter image description here

Upvotes: 7

Aing Macan
Aing Macan

Reputation: 187

You can use this method.

npm i react-router-sitemap

Upvotes: 0

Related Questions