NexT 高级配置

前一篇文章介绍了NexT的基本配置,其主要涉及两个配置文件第一个是主目录下的_config.yml,另外一个是咱们的主题配置文件thems/next/_config.yml,接下来咱们继续深刻。html

添加社交网址

thems/next/_config.yml查找 social,找到以下代码:git

# Social Links.
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimeter is the target permalink.
# Value after `||` delimeter is the name of FontAwesome icon. If icon (with or without delimeter) is not specified, globe icon will be loaded.
social:
  #GitHub: https://github.com/yourname || github
  E-Mail: mailto:yourname@gmail.com || envelope
  #Weibo: https://weibo.com/yourname || weibo
  #Google: https://plus.google.com/yourname || google
  #Twitter: https://twitter.com/yourname || twitter
  #FB Page: https://www.facebook.com/yourname || facebook
  #VK Group: https://vk.com/yourname || vk
  #StackOverflow: https://stackoverflow.com/yourname || stack-overflow
  #YouTube: https://youtube.com/yourname || youtube
  #Instagram: https://instagram.com/yourname || instagram
  #Skype: skype:yourname?call|chat || skype
复制代码

去掉 social 的注释并将你须要展现的信息网址注释去掉,能够修更名称和网址。github

效果如图:bash

页面底部添加访问量

thems/next/_config.yml查找 busuanzihexo

busuanzi_count:
  enable: true
  total_visitors: true
  total_visitors_icon: user
  total_views: true
  total_views_icon: eye
  post_views: true
  post_views_icon: eye
复制代码

效果如图:app

为文章添加评论与阅读次数

leancloud上面注册账号,新建一个应用,找到应用对应的appidappkey,而后在thems/next/_config.yml查找 valine,将填入appidappkey如下代码中,相应字段设为truepost

valine:
  enable: true # When enable is set to be true, leancloud_visitors is recommended to be closed for the re-initialization problem within different leancloud adk version.
  appid:  # your leancloud application appid
  appid:  # your leancloud application appkey
  notify: false # mail notifier , https://github.com/xCss/Valine/wiki
  verify: false # Verification code
  placeholder: Just go go # comment box placeholder
  avatar: mm # gravatar style
  guest_info: nick,mail,link # custom comment header
  pageSize: 10 # pagination size
  visitor: true # leancloud-counter-security is not supported for now. 
复制代码

为页面添加搜索功能

thems/next/_config.yml查找 local_search,并将enable设为true网站

local_search:
  enable: true
  # if auto, trigger search by changing input
  # if manual, trigger search by pressing enter key or search button
  trigger: auto
  # show top n results per article, show all results by setting to -1
  top_n_per_article: 1
  # unescape html strings to the readable one
  unescape: false
复制代码

而后访问注释提供的网址,按它的步骤操做。ui

文章分享连接

thems/next/_config.yml查找 needmoreshare,并将enable设为truegoogle

needmoreshare2:
  enable: true
  postbottom:
    enable: true
    options:
      iconStyle: box
      boxForm: horizontal
      position: bottomCenter
      networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook
  float:
    enable: true
    options:
      iconStyle: box
      boxForm: horizontal
      position: middleRight
      networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook

复制代码

而后访问注释提供的网址,按它的步骤操做。

博客页脚记时

打开 \themes\next\layout\_partials\footer.swig,在最下面添加以下代码:

<script>
    var now = new Date();
    function createtime() {
        var grt= new Date("12/03/2018 00:00:00");//此处修改你的建站时间或者网站上线时间
        now.setTime(now.getTime()+250);
        days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
        if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
        mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
        snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;}
        document.getElementById("timeDate").innerHTML = "Running for "+dnum+" Days ";
        document.getElementById("times").innerHTML = hnum + " Hours " + mnum + " m " + snum + " s";
    }
    setInterval("createtime()",250);
</script>
复制代码

并将如下代码放在这个文件你喜欢的位置,而后查看效果。

<div>
<span id="timeDate"></span><span id="times"></span>
</div>
复制代码

NexT高级配置就介绍这么多,至此,咱们已搭建出一个比较完整的博客,而后接下来就能够快乐的写博客啦!

相关文章
相关标签/搜索