Hexo搭建个人博客

添加Local Search功能

安装 hexo-generator-searchdb,在你的站点文件夹中,用shell等运行下面这行代码:

1
$ npm install hexo-generator-searchdb --save

编辑站点配置文件添加以下字段

1
2
3
4
5
search:
path: search.xml
field: post
format: html
limit: 10000

编辑主题配置文件启用本地搜索

1
2
3
# Local search
local_search:
enable: true

添加百度统计

  • 注册并登陆百度统计
  • 在网站中心–>代码获取中点击复制代码
  • 打开F:\Hexo\themes\pacman\layout\after_footer.ejs文件,把刚才复制的代码复制到最下面即可;
  • 然后在网站中心–>代码安装检查中检测代码是否添加成功

    注意:因为主题用的不同,可能代码添加位置也不一样,但基本都是在/themes/yourtheme/layout/after_footer.ejs中添加即可

|