hexo-theme-april-添加百度统计

新建baidu-analytics.ejs添加百度统计代码

<% if (config.baidu_analytics) {%>
    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
              var hm = document.createElement("script");
              hm.src = "//hm.baidu.com/hm.js?<%= config.baidu_analytics %>";
              var s = document.getElementsByTagName("script")[0];
              s.parentNode.insertBefore(hm, s);
        })();
    </script>
<% } %>

编辑head.ejs,在</head>前添加百度统计

<%- partial('baidu-analytics') %>

编辑网站配置_config.yml,添加百度统计ID

# Analylics
baidu_analytics: your baidu_analytics id