1. Hexo博客添加访问量统计

Tips:前导必备

1、配置是否开启不蒜子访问量统计功能

    在themes/yilia/_config.yml添加属性

# 是否开启访问量统计功能(不蒜子)
busuanzi:
 enable: true


2、引入不蒜子并添加站点访问量

    在themes/yilia/layout/_partial/footer.ejs末尾添加如下代码

<% if (theme.busuanzi && theme.busuanzi.enable){ %>
        <!-- 不蒜子统计 -->
        <span id="busuanzi_container_site_pv">
                本站总访问量<span id="busuanzi_value_site_pv"></span></span>
        <span class="post-meta-divider">|</span>
        <span id="busuanzi_container_site_uv" style='display:none'>
                本站访客数<span id="busuanzi_value_site_uv"></span></span>
        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  <% } %>


3、添加文章访问量

    在themes/yilia/layout/_partial/post/date.ejs开头添加如下代码

<% if (theme.busuanzi && theme.busuanzi.enable && !index){ %>
        <!-- 不蒜子统计 -->
        <span id="busuanzi_container_page_pv" style='display:none' class="<%= class_name %>">
              <i class="icon-smile icon"></i> 阅读数:<span id="busuanzi_value_page_pv"></span></span>
<% } %>

  • 重启即可查看效果

4、作者寄语

Everything is ok. But you have to do by yourself.

Copyright © 試毅-思伟 2019 all right reserved,powered by 試毅-思伟修订时间: 2019-07-02 14:28:48

results matching ""

    No results matching ""