NexT7.7.x版本添加访问量和访客数

最近看多了别人的个人博客网站弄得挺精致的,居然有访客数访问量,不行我也不能落后,所以自己也准备升级下自己简陋的博客网站哈哈。

由于我的 Hexo 的版本(7.7.2) 在目前来说是最新的,所以通过百度和google查询到的资料不多,所以耗费了好几个小时在搜查相关的资料,终于功夫不负有心人,最终升级成功。

官网说, 他们在第三方服务中提供了 不蒜子统计 的功能,看来多看看官网还是有好处的哈哈。
在这里插入图片描述

1.参照了相关的资料,需要修改将 主题配置文件 中的busuanzi_count的配置项。

# Show Views / Visitors of the website / page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi
busuanzi_count:
  enable: true

footer.swig 添加以下内容,该文件在径"\themes\next\layout\_partials\

<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_pv">
	<span class="post-meta-item-icon">
		<i class="fa fa-eye"></i>
	</span>
	访问量:<span id="busuanzi_value_site_pv"></span> 次数
</span>

<span class="post-meta-divider">|</span>
	<span id="busuanzi_container_site_uv">
	访客数:<span id="busuanzi_value_site_uv"></span> 人次
</span>

注意: 以上内容放错位置可就显示的不好看哦

把这段内容添加 <div div class="copyright"> 模块的末尾添加,示例如下

<div class="copyright">
  {% set copyright_year = date(null, 'YYYY') %}
  &copy; {% if theme.footer.since and theme.footer.since != copyright_year %}{{ theme.footer.since }} – {% endif %}
  <span itemprop="copyrightYear">{{ copyright_year }}</span>
  <span class="with-love">
    <i class="fa fa-{{ theme.footer.icon.name }}"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">{{ theme.footer.copyright or author }}</span>

  {%- if config.symbols_count_time.total_symbols %}
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    {%- if theme.symbols_count_time.item_text_total %}
      <span class="post-meta-item-text">{{ __('symbols_count_time.count_total') + __('symbol.colon') }}</span>
    {%- endif %}
    <span title="{{ __('symbols_count_time.count_total') }}">{{ symbolsCountTotal(site) }}</span>
  {%- endif %}

  {%- if config.symbols_count_time.total_time %}
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    {%- if theme.symbols_count_time.item_text_total %}
      <span class="post-meta-item-text">{{ __('symbols_count_time.time_total') }} &asymp;</span>
    {%- endif %}
    <span title="{{ __('symbols_count_time.time_total') }}">{{ symbolsTimeTotal(site, theme.symbols_count_time.awl, theme.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}</span>
  {%- endif %}

  //添加的位置从这里开始
  <span class="post-meta-divider">|</span>
  <span id="busuanzi_container_site_pv">
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    访问量:<span id="busuanzi_value_site_pv"></span> 次数
  </span>

  <span class="post-meta-divider">|</span>
  <span id="busuanzi_container_site_uv">
    访客数:<span id="busuanzi_value_site_uv"></span> 人次
  </span>
  //这里结束
</div>

重新部署一下,需要的内容就出来啦!

效果如下:
在这里插入图片描述

发布了18 篇原创文章 · 获赞 0 · 访问量 425

猜你喜欢

转载自blog.csdn.net/mikelv01/article/details/104888348