hexo添加百度统计

litten的主题yilia

  • 编辑文件 themes/yilia/_config.yml,添加一行配置,可以删除原来的google analytics

baidu_tongji: true

  • 新建 themes/yilia/layout/_partial/baidu_tongji.ejs,内容如下
<% if (theme.baidu_tongji) { %>
<script type="text/javascript">
#申请的百度统计代码
</script>
<% } %>
  • 编辑themes/yilia/layout/_partial/head.ejs 在 </head> 前添加<%- partial("baidu_tongji") %>
  • 重新生产部署站点即可。

参考

原文地址:https://www.cnblogs.com/fazero/p/7976651.html