NexT 高级配置
前一篇文章介紹了NexT的基本配置,其主要涉及兩個配置文件第一個是主目錄下的_config.yml,另一個是我們的主題配置文件thems/next/_config.yml,接下來我們繼續深入。
添加社交網址
在thems/next/_config.yml查找 social,找到如下代碼:
# 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 || githubE-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 的注釋并將你需要展示的信息網址注釋去掉,可以修改名稱和網址。
效果如圖:
頁面底部添加訪問量
在thems/next/_config.yml查找 busuanzi
busuanzi_count:enable: truetotal_visitors: truetotal_visitors_icon: usertotal_views: truetotal_views_icon: eyepost_views: truepost_views_icon: eye 復制代碼效果如圖:
為文章添加評論與閱讀次數
在leancloud上面注冊帳號,新建一個應用,找到應用對應的appid和appkey,然后在thems/next/_config.yml查找 valine,將填入appid和appkey以下代碼中,相應字段設為true:
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 appidappid: # your leancloud application appkeynotify: false # mail notifier , https://github.com/xCss/Valine/wikiverify: false # Verification codeplaceholder: Just go go # comment box placeholderavatar: mm # gravatar styleguest_info: nick,mail,link # custom comment headerpageSize: 10 # pagination sizevisitor: 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 buttontrigger: auto# show top n results per article, show all results by setting to -1top_n_per_article: 1# unescape html strings to the readable oneunescape: false 復制代碼然后訪問注釋提供的網址,按它的步驟操作。
文章分享鏈接
在thems/next/_config.yml查找 needmoreshare,并將enable設為true。
needmoreshare2:enable: truepostbottom:enable: trueoptions:iconStyle: boxboxForm: horizontalposition: bottomCenternetworks: Weibo,Wechat,Douban,QQZone,Twitter,Facebookfloat:enable: trueoptions:iconStyle: boxboxForm: horizontalposition: middleRightnetworks: 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高級配置就介紹這么多,至此,我們已搭建出一個比較完整的博客,然后接下來就可以快樂的寫博客啦!
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
- 上一篇: 探究call 和 apply 的原理
- 下一篇: 可变大小、颜色边框、样式的UISwitc