1
3 Comments

Generating sitemap for a create-react-app

I feel like this is a dumb question but I am trying to generate a site map using https://www.xml-sitemaps.com/ which I've used in the past but first time with a create react app.

The project uses react-router-dom to create individual internal routes within the project. However, when I get the sitemap generator to run it doesn't find any links, just the 1 for the home page. I thought initially it might be because I forgot to add a rel=follow attribute to the link but then when looking at my blog (which uses Ghost) none of those links appear to have a rel=follow yet the sitemap generator sees all of the different links available within the blog site.

Is there something special that you have to do differently for a create-react-app to get a sitemap automatically generated in the same way?

posted to Icon for group Help
Help
on August 8, 2022
  1. 1

    most likely this tool doesn't have the ability to crawl the pages created by react. When you create internal routes they are not visible to external crawlers since they rely on server request and you are not making any request. You will need to generate static pages that you want to crawl. May be use nextjs or some other framework and configure it to generate static site with hydration.

    1. 1

      Thanks. I hadn't realised that. I have a terrible habit of forgetting sitemaps as an afterthought.

      I've done a bit more googling around and found there appears to be an npm package that can generate it, which I'll prob take a look at implementing - hopefully something simple.

      I have tried nextjs before (not for the sitemap just in general) didn't like it though, in fact I actually just converted a nextjs project back to a create-react-app.

Trending on Indie Hackers
I spent $0 on marketing and got 1,200 website visitors - Here's my exact playbook User Avatar 58 comments Veo 3.1 vs Sora 2: AI Video Generation in 2025 🎬🤖 User Avatar 28 comments Codenhack Beta — Full Access + Referral User Avatar 21 comments I built eSIMKitStore — helping travelers stay online with instant QR-based eSIMs 🌍 User Avatar 20 comments 🚀 Get Your Brand Featured on FaceSeek User Avatar 18 comments Day 6 - Slow days as a solo founder User Avatar 16 comments