Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

reactjs - Setting up complex sitemap in React-Router (without using react-router-sitemap)

I have a pretty complex sitemap setup for a site with tens of thousands of links. As such, it's divided up among multiple xml files, however my employer also requested that the sitemaps be organized under indexes such that they reflect the site's interaction flow. For example, my site will have a page url like:

https://www.example.com/page1

Where page1 has thousands of subpages. So what I did was I created an index specifically for links under page1 called page1-index.xml, and needs to be accessible under https://www.example.com/page1/page1-index.xml. Since there are thousands of links, they're also separated into multiple categories, with each category being its own sitemap linked in page1-index.xml.

So what I've got is an index at https://www.example.com/page1/page1-index.xml, and hundreds of sitemaps linked in that xml as https://www.example.com/page1/page1-category-n-sitemap.xml.

All the sitemap files are in a subfolder in the public folder with a tree that reflects the sitemap, so page1-index.xml is in public/sitemaps/page1/page1-index.xml so that a single route in my App.tsx can cover all sitemaps. Where I'm mainly confused is how exactly I should be returning these xmls in the router. I've got thousands of sitemaps so it's not practical for me to be submitting each individually to search engines. If I submit the indexes then the crawlers need to be able to access the individual sitemaps and that's where I'm uncertain on how to set it up. How should I set up a route or routes to return the xml files when the crawler accesses a link from the index?

question from:https://stackoverflow.com/questions/65876748/setting-up-complex-sitemap-in-react-router-without-using-react-router-sitemap

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...