sitemap 不直接提升排名,但它解决的是收录效率:新页面主动递到搜索引擎嘴边,不用等爬虫自己撞上来。内容站每天发文章,蜘蛛抓取频次又不高的时候,sitemap 就是收录的生命线。
格式很简单,一个 XML 文件列出 URL、更新时间、更新频率、优先级:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/article/123.html</loc>
<lastmod>2026-08-26T10:00:00+08:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
lastmod 是唯一真正有用的字段,搜索引擎主要靠它判断要不要重新抓取。changefreq 和 priority 基本是摆设,别花时间纠结。单文件上限 5 万条 URL、10MB,超了就拆分再用 sitemapindex 索引文件组装。
动态生成的思路:sitemap.php 从数据库读最新文章列表输出 XML,Nginx 里把它伪装成 sitemap.xml——这样新文章发布即进地图,不用手动维护:
# nginx.conf
location = /sitemap.xml {
rewrite ^ /sitemap.php last;
}
# robots.txt 里声明
Sitemap: https://example.com/sitemap.xml
提交环节,百度走搜索资源平台的普通收录 API 或自动推送,Google 用 Search Console 的站点地图功能填上地址。之后每次大批量更新内容,手动 ping 一下能加速:
# Google 主动通知
curl "https://www.google.com/ping?sitemap=https://example.com/sitemap.xml"
# 百度用资源平台的推送接口,token在平台后台拿
curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://data.zz.baidu.com/urls?site=example.com&token=你的token"
最后盯 Search Console 的覆盖率报告,如果 sitemap 里大量 URL 显示已提交未编入索引,问题多半出在内容质量或重复页面,不是 sitemap 本身。地图只管带路,收录与否还是内容说了算。
A5创业网 版权所有