mkdocs和material搭建网站统计阅读量
编辑日期: 2024-11-28 文章阅读: 次
1. 添加这个js脚本
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
2 添加前端展示
根目录下base.html-{{ page.content }}上添加:
<span id="busuanzi_container_page_pv">
本文总阅读量<span id="busuanzi_value_page_pv"></span>次
,原创教程,严禁转载
</span>
3 partials文件下替换2个文件
在header.html文件里head标签最底下添加:
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?806350916dcebea05726074fa038e721";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
4.2 在footer.html文件里footer标签最底下:
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
<span id="busuanzi_container_site_pv">
本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>
</div>
{% if config.copyright %}
<div class="md-footer-copyright__highlight">
{{ config.copyright }}
</div>
{% endif %}
<div class="md-footer-copyright__highlight">
<a href="https://beian.miit.gov.cn/">京ICP备20031037号-1</a>
</div>
{{ extracopyright }}
</div>
{% include "partials/social.html" %}
</div>
</div>