sitemapgen4j的No URLs added, sitemap index would be empty; you must add some URLs with add異常

來源:互聯網
上載者:User

sitemap基礎知識:http://wenku.baidu.com/view/bb33f4956bec0975f465e277.html見這個文檔

情景:

       線上線下資料量不一致導致,線上資料較多,加上wsg.writeSitemapsWithIndex();這句代碼,把產生的sitemap.xml檔案分成多個。線下資料較少,不需要wsg.writeSitemapsWithIndex();這句。由於線下測試,這句代碼沒注釋掉,就會報No URLs added, sitemap index would be empty; you must add some URLs with add異常。

解決方案:

       根據資料量的多少,使用wsg.writeSitemapsWithIndex();控制sitemap.xml組建檔案數。資料量少,就可以不用這段代碼,否則會報異常。資料量超過5w,不加wsg.writeSitemapsWithIndex();這句代碼,只會讓超出5w的URL加入不進去,導致資料缺失,並不會報錯。所以,要當資料量超過5w,需要加入wsg.writeSitemapsWithIndex();這句代碼。

備忘:

       一個sitemap檔案最多5w條URL,超過的話,需要加索引,即需要加入wsg.writeSitemapsWithIndex()。否則,超出5w的URL就不會加入sitemap檔案中。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.