一个典型的用法如下:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.lebang2020.cn/home.html</loc>
<lastmod>2021-01-11</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://lebang2020.cn/details/210119im4tewz3.html</loc>
<lastmod>2021-01-21</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
url可写多组,但是总体站点地图文件不要超过500条链接,如果超过了,就要分文件了。其中 changefreq表示更新频率,有以下选项:
- always
- hourly
- daily
- weekly
- monthly
- yearly
- never
在Url中的转义符列表如下:
Character | Escape Code | |
---|---|---|
Ampersand | & | & |
Single Quote | ' | ' |
Double Quote | " | " |
Greater Than | > | > |
Less Than | < | < |
下面给一个多文件索引示例:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://lebang2020.cn/part1/sitemaps.xml</loc>
<lastmod>2004-01-19</lastmod>
</sitemap>
<sitemap>
<loc>https://lebang2020.cn/part2/sitemaps.xml</loc>
<lastmod>2020-12-31</lastmod>
</sitemap>
</sitemapindex>
一个比较权威的站点:sitemaps 标准
同时也发布我的个人博客中:我的博客