GitHub Page 已经和百度决裂,如果还不做一些 SEO 的话,网站的流量真的太少了。所以我准备做一个站点地图讨好下各大搜索引擎。站点地图是一种文件,您可以通过该文件列出您网站上的网页,从而将您网站内容的组织架构告知Google和其他搜索引擎。搜索引擎网页抓取工具会读取此文件,以便更加智能地抓取您的网站。
- 首先打开hexo博客根目录,分别用下面两个命令来安装针对谷歌和百度的插件:
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
- 在博客目录的_config.yml中添加如下代码:
Plugins:
- hexo-generator-baidu-sitemap
- hexo-generator-sitemap
baidusitemap:
path: baidusitemap.xml
sitemap:
path: sitemap.xml
hexo-g 后,在博客根目录的public下生成了sitemap.xml以及baidusitemap.xml就表示操作成功。
但是我在在 hexo-g 后出现了bug:
FATAL duplicated mapping key at line 70, column 18:
path: sitemap.xml
- 本文作者:NickYam
- 本文链接:https://www.nickyam.com/2018/12/31/hexo-generate-sitemap/
- 版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!
网友评论