百度一般都是通过站的sitemap.xml来进行页面爬取和索引,所以你必须在网站的根目录下生成一个sitemap.xml文件,让百度知道你的站点更新的啥,sitemap.xml的地址可以放到 robots.txt 文件中。
根目录 robots.txt如下,这里定义了user-agent,表示容许哪些爬虫来爬取,*表示所有,百度叫Baiduspider,谷歌叫Googlebot,Disallow表示哪些页面和目录不容许爬取。注意:sitemap 谷歌为xml格式,百度为html格式
User-agent: *那么sitemap怎么写呢
Disallow:
Disallow: /admin/
Sitemap: http://domain.com/sitemap.xml
<?xml version="1.0" encoding="UTF-8" ?>loc就是需要百度检索的网页url;
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
<url>
<loc>https://www.domian.com/</loc>
<mobile:mobile type="pc,mobile" />
<priority>0.8</priority>
<lastmod>2021-05-14</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.domian.com/blog/1.html</loc>
<mobile:mobile type="pc,mobile" />
<priority>0.8</priority>
<lastmod>2021-05-14</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://www.domian.com/blog/</loc>
<mobile:mobile type="pc,mobile" />
<priority>0.8</priority>
<lastmod>2021-05-14</lastmod>
<changefreq>weekly</changefreq>
</url>
</urlset>
mobile表示是否支持手机和pc的自适应显示;
priority用来指定此链接相对于其他链接的优先权比值,取值范围为0.0~1.0之间。值越大,表示此链接的优先权就越高;
lastmod表示上次修改时间;
changefreq表示修改频率,可以填写:“always”(经常) 、“hourly”(每时)、“daily”(每天)、“weekly”(每周)、“monthly”(每月)、“yearly”(每年)。像首页就可以用“always”;对于很久前的链接或不再更新内容的链接就可以使用“yearly”
网友回复
js如何流式输出ai的回答并折叠代码块,点击代码块右侧可预览代码?
ai大模型如何将文章转换成可视化一目了然的图片流程图图表?
大模型生成html版本的ui原型图和ppt演示文档的系统提示词怎么写?
rtsp视频直播流如何转换成websocket流在h5页面上观看?
为啥coze会开源工作流agent coze studio?
如何检测网页是通过收藏夹打开的?
python如何实现类似php的http动态脚本请求处理响应代码?
js如何实现类似php的http动态脚本请求处理响应代码?
trae与solo有啥区别不同?
vue如何让ai动态生成问卷调查多步骤表单式收集基础信息自动规划执行任务?