How to let sitemap generator fully crawl Angular router for SPA?

前端 未结 1 1604
眼角桃花
眼角桃花 2021-02-19 08:46

I am trying to generate a sitemap for my webpage.

The sitemap generators online only show me a homepage on xml file.



        
1条回答
  •  青春惊慌失措
    2021-02-19 09:20

    As Karl the Botmap.io developer answers the question the crawler only supports href links.

    Hi! Do your links/anchor tags have an href attribute? The bot currently only detects and crawls the href attribute. You can add it even if your angular app doesn't use it internally. It may be redundant, however it may work as a stopgap until I can update the bot to handle this scenario.

    Since Im using routerlinks and I don't want to change my code using hrefs I decided to manually create Sitemap.

    
    
    http://margvel.com0.5
    http://margvel.com/projects0.5
    http://margvel.com/jobs0.5
    http://margvel.com/education0.5
    http://margvel.com/resume0.5
    http://margvel.com/contact0.5
    
    

    All I did was went through the routes in angular and put them in xml file like displayed above.

    I gave all the links priority 0.5 since it is the manual priority chosen between 0 - 1.0 . I didn't have any preference for pages.

    NOTE - This approach is only for small sitemaps with small amount of pages.

    0 讨论(0)
提交回复
热议问题