Skip to content

Hk4Fun/Hk4Fun.github.io

Repository files navigation

主页:https://hk4fun.github.io

部署平台:GitHub Pages

框架:Hexo

主题:Yelee 使用说明(fork 于 Yilia

分享:AddThis

图床:微博图床

网站统计:百度统计

页面统计:不蒜子

评论系统:来必力(Livere)

写作工具:Typora

由于yelee没有加入livere评论系统,需要自己添加:

首先在主题的 _config.yml 文件中添加如下配置:

livere:
  on: true

然后在\themes\yelee\layout\_partial\comments下添加livere.ejs,把livere安装代码复制进去,文件内容如下,其中data-uid就是你自己的data-uid

<!-- 来必力City版安装代码 -->
<div id="lv-container" data-id="city" data-uid="your data-uid" style="margin-left:30px;margin-right:30px">
<script type="text/javascript">
   (function(d, s) {
       var j, e = d.getElementsByTagName(s)[0];

       if (typeof LivereTower === 'function') { return; }

       j = d.createElement(s);
       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
       j.async = true;

       e.parentNode.insertBefore(j, e);
   })(document, 'script');
</script>
<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
</div>
<!-- City版安装代码已完成 -->

注意官网livere给的安装代码没有margin-left:30px;margin-right:30px,这个样式是为了不与左边栏叠加

最后在\themes\yelee\layout\_partial\article.ejs中的<% if (!index && post.comments){ %>后面插入:

<% if (theme.livere.on){ %>
    <%- partial('comments/livere', {
        key: post.path,
        title: post.title,
        url: config.url+url_for(post.path)
      }) %>

至此,为yelee主题添加livere评论插件完成

最后向Hexo作者tommy致敬!(附上Hexo起源之地

更新:不蒜子的域名更新了,需要在 MyBlog\themes\yelee\layout_partial\after-footer.ejs 中将不蒜子的域名由

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"> </script>

改为

<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"> </script>