解决yelee模板下live2d看板娘和busuanzi不蒜子计数冲突
字数统计:
843字
|
阅读时长:
4分
今天强迫症又双发作,这次没忍住,折腾了下。重于把hexo-helper-live2d 与busuanzi 两个插件共存时产生冲突的问题解决了。
问题描述
未安装live2d且不蒜子配置正常,执行npm install --save hexo-helper-live2d
后,不蒜子计数冲突不显示计数。
已安装live2d但live2d.enable
由true
改为false
后,不蒜子显示计数。
同时正常时,代码为:
1 2 3 4 5 6 7 8
| <span id="busuanzi_container_site_pv"> | <i class="far fa-eye"></i> 总访问量: <span id="busuanzi_value_site_pv" class="white-color"></span> 次 </span> <span id="busuanzi_container_site_uv"> | <i class="fas fa-users"></i> 总访问人数: <span id="busuanzi_value_site_uv" class="white-color"></span> 人 </span>
|
异常时,代码为:
1 2 3 4 5 6 7 8 9
| <span id="busuanzi_container_site_pv" style="display: none;"> | <i class="far fa-eye"></i> 总访问量: <span id="busuanzi_value_site_pv" class="white-color"></span> 次 </span> <span id="busuanzi_container_site_uv" style="display: none;"> | <i class="fas fa-users"></i> 总访问人数: <span id="busuanzi_value_site_uv" class="white-color"></span> 人 </span>
|
解决方案
1.打开footer.ejs文件,找到与不蒜子相关的代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <% if (theme.visit_counter.on) { %> <div class="visit"> <% if (theme.visit_counter.site_visit) { %> <span id="busuanzi_container_site_pv" style='display:inline'> <span id="site-visit" title="<%= __('visit_counter.site') %>"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span> </span> </span> <% } %> <% if (theme.visit_counter.site_visit && theme.visit_counter.page_visit) { %> <span>| </span> <% } %> <% if (theme.visit_counter.page_visit) { %> <span id="busuanzi_container_page_pv" style='display:inline'> <span id="page-visit" title="<%= __('visit_counter.page') %>"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span> </span> </span> <% } %> </div> <% } %>
|
2.删除<span id="busuanzi_container_page_pv" style='display:inline'>
和<span id="busuanzi_container_site_pv" style='display:inline'>
语句。
3.在<% if (theme.visit_counter.on) { %>
语句后,添加<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <% if (theme.visit_counter.on) { %> <script async="" src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"> </script> <div class="visit"> <% if (theme.visit_counter.site_visit) { %> <span id="site-visit" title="<%= __('visit_counter.site') %>"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span> </span> </span> <% } %> <% if (theme.visit_counter.site_visit && theme.visit_counter.page_visit) { %> <span>| </span> <% } %> <% if (theme.visit_counter.page_visit) { %> <span id="page-visit" title="<%= __('visit_counter.page') %>"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span> </span> </span> <% } %> </div> <% } %>
|
4.打开after-footer.ejs
,删除<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
.