自动抓取 public_dir 目录下的文件推送到百度站长平台
安装
npm install --save hexo-mip-push
配置
# _config.yml
url: https://www.example.com
deploy:
- type: 'mip'
token: 'token'
site: 'www.example.com'
pattern: '**/*.html'
defaultIndex: ''
ignore:
- '/ignore.html'
- '/^/404/'| 变量名 | 说明 | 默认值 |
|---|---|---|
| token | 百度站长平台 MIP 数据提交的 token |
- |
| site | 百度站长平台 MIP 站点的 site |
- |
| pattern | 搜索文件规则, glob模式, 以 public_dir 为基础路径 |
**/*.html |
| defaultIndex | 默认主页, 如果配置相同的目录主页将被删除 | - |
| ignore | 忽略不提交的文件, 如果以 / 开头和结束, 将使用正则判断 |
- |
- /ignore.html
- /^/404/
- /error/将忽略:
- 完全匹配的
/ignore.html路径 - 正则匹配
^\/404成功的路径 - 正则匹配
error成功的路径
内部使用的
new RegExp()生成的正则判定
抓取到的文件如:
[
"/archives/index.html",
"/index.html",
"/post/about.html"
]生成的提交链接如:
[
"https://www.example.com/archives/",
"https://www.example.com/",
"https://www.example.com/post/about.html"
]注意, 如果
ignore和defaultIndex同时配置, 将先使用ignore处理忽略文件, 再使用defaultIndex处理默认首页