Ad

React Sitemap.xml

- 1 answer

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.

Ad

Answer

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

Ad
source: stackoverflow.com
Ad