准备
- 去Livere官网注册Livere账号。
- 选择City版(免费),安装
- 进入管理页面->代码管理->一般网站,复制data-uid
在Hexo中添加Livere
以下基于主题Next,其他主题做法类似
- 打开
博客根目录/themes/next/_config.yml
将# Third Party Services Settings 栏目下其他评论系统如duoshuo、gentie、youyan、disqus用#注释掉,加入以下内容
1
2# Livere评论系统
livere_uid: 上一步中你获取的data-uid在博客根目录
/themes/layout/_scripts/third-party/comments/
目录中新建txt文件,重命名为livere.swig,编辑内容如下:
1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname and not theme.hypercomments_id and not theme.gentie_productKey %} |
在
博客根目录/themes/layout/_scripts/third-party/comments.swig
文件中追加:1
{% include './comments/livere.swig' %}
在博客根目录
/themes/layout/_partials/comments.swig
文件中条件最后追加 LiveRe 插件是否引用的判断逻辑:1
2
3{% elseif theme.livere_uid %}
<div id="lv-container" data-id="city" data-uid="{{ theme.livere_uid }}"></div>
{% endif %}
重新hexo clean、hexo d -g
,然后就可以看到来必力评论啦~
ps:因为是国外的,评论加载有点慢。