sitemap 0.9 标准的网站地图协议 for Google / Bing / Yahoo / Baidu
2024-08-08T17:23:33+08:00 | 1 minute read | Update at 2024-08-26T16:00:09Z
sitemap 0.9 协议已被各大搜索引擎纳入标准的地图协议,建议各站长将尽快将网站地图更新至本版本,为 SEO 收录提供友好的基础保障。
sitemap
作为 SEO
中一项利器是非常必须的,友好的 sitemap
可以帮助爬虫更好更快的理解和收录你的网站内容,目前各大搜索
引擎已经遵循了 sitemap0.9
协议标准。
sitemap.xml
先来看一下协议说明:sitemaps protocol
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.yoursite.com</loc>
<lastmod>2024-06-14</lastmod>
<changefreq>weekly</changefreq>
<priority>1</priority>
</url>
<url>
<loc>https://www.yoursite.com/news.html</loc>
<lastmod>2024-06-14</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
</urlset>
注意:
- 和所有 XML 文件一样,所有标记值都必须实体转义。
- Google 会忽略 priority 和 changefreq 值。
- 如果 lastmod 值始终准确并可验证(例如通过与网页的最后修改日期进行比较),Google 会使用该值。
changefreq
可选值: daily / weekly / monthly / yearly,请根据实际来评估这项值的准确性,不要认为 daily
会使得爬虫频繁光顾你的站点,
狼来了
的故事爬虫也听过的。
sitemap index
注意:sitemap 中的记录数不应超出 5k,否则请使用地图文件索引模式来解决:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.example.com/sitemap_news.xml</loc>
<lastmod>2024-06-14</lastmod>
</sitemap>
<sitemap>
<loc>https://www.example.com/sitemap_products.xml</loc>
<lastmod>2024-06-14</lastmod>
</sitemap>
</sitemapindex>
通过对 sitemap
的拆分,使用索引模式来提交收录。