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.
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.
2
Answers
You can use this method.
npm i react-router-sitemap
If you already have a
sitemap.xml
file ready with you, just put it underpublic
directory. Anything underpublic
directory can be directly opened by putting its path after domain url (even if you are usingreact-router-dom
). So,sitemap.xml
put underpublic
directory will be available at http://www.mysite.com/sitemap.xml in your case.