1.安装插件

1
2
npm install hexo-generator-baidu-sitemap --save
npm install hexo-generator-sitemap --save

修改站点配置文件

1
2
3
4
5
6
url: https://blog.hihahoo.com
# 站点地图
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml

hexo ghexo s 后,可以访问 localhost:4000/sitemap.xml 查看站点地图。

2.提交百度收录

查看站点是否被收录。

1
site:https://blog.hihahoo.com

登录百度搜索资源平台,添加站点信息

通过上图的验证码对网站的所有权验证,建议选择验证码方式,直接修改主题配置文件

1
2
3
4
5
site_verification:
# - name: google-site-verification
# content: xxxxxx
- name: baidu-site-verification
content: HznZlBpisgS2ytDy

3.新文章自动提交百度收录

安装插件

1
npm install hexo-baidu-url-submit --save

修改站点配置文件

1
2
3
4
5
6
# 主动推送百度,被百度收录
baidu_url_submit:
count: 10 #提交最新的10个链接
host: https://blog.hihahoo.com # 百度站长平台中注册的域名
token: XXXXX #密钥,百度站长平台 > 推送接口 > 接口调用地址中token 字段
path: baidu_urls.txt #文本文档的地址,新链接会保存在此文本文档中,不用改

hexo d -g 的时候都会主动生成对应文件推送百度