Ad

How To Index Dynamic Routes In Google Using NextJS

- 1 answer

I know how to use reactJS, but now I am creating a web page made with nextJS to improve SEO, but I have a question.

How do I make my dynamic routes made with NextJS known to google? I understand that we have getStaticPaths and in routes we can put all the routes and by setting fallback to true we can add the dynamic routes without specifying them, but how do I do when I have a million routes and I want google to index them and they can appear in the searches? Thank you very much I hope someone helps me: D

Ad

Answer

You can provide a sitemap, that search engines use to define what paths your site contains. That way they know which paths to crawl through.

Googling sitemap + next.js gave this tutorial for example, but for super simple site you could just define it manually too: https://cheatcode.co/tutorials/how-to-generate-a-dynamic-sitemap-with-next-js

Ad
source: stackoverflow.com
Ad