Here's how to add a sitemap to a React-only project.
If you're normally using another framework on the backend, that framework will usually handle this for you — but if you just build React and run it simply on its own, you'll have to create it yourself.
How to Do It: Manually
Create a sitemap.xml file under the public directory.
Write something like the following in it.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://yourdomain.com/</loc>
<priority>1.0</priority>
</url>
<url>
<loc>https://yourdomain.com/company</loc>
<priority>0.8</priority>
</url>
<url>
<loc>https://yourdomain.com/office-treatment</loc>
<priority>0.8</priority>
</url>
<!-- 他のルートをここに追加 -->
</urlset>Next, write the following in robots.txt.
Sitemap: https://your-page.com/sitemap.xmlReplace "your-page" with your own domain.