Hexo接入网易云评论

来源:互联网 发布:scada系统数据分析 编辑:程序博客网 时间:2024/06/05 15:43

搞了GitPage之后不久看到多说评论6月份要关闭的消息,一直在琢磨换哪家,大家都有不同的观点,我还是觉得网易的云跟帖值得拥有,毕竟是大厂并且是易友好多年。

不多说,说干就干。我使用的是Hexo的插件indigo。

注册网易云跟帖

填写站点的基本信息

mark

填写站长信息

mark

获取代码

mark

代码留作稍后使用

插件配置

在themes/indigo/layout/_partial/plugins/下创建neteast.ejs文件,仿照原有的duoshuo.ejs将刚刚复制的云跟帖代码加入到如下代码中间

<% if (theme.netease){ %>    ......<% } %>    

最后的neteast.ejs内容如下(其中的productKey的Tie.loader内容请替换为自己申请的):

<% if (theme.netease){ %>    <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>    <script src="https://img1.cache.netease.com/f2e/tie/yun/sdk/loader.js"></script>    <script>    var cloudTieConfig = {      url: document.location.href,      sourceId: "",      productKey: "**********************",      target: "cloud-tie-wrapper"    };    var yunManualLoad = true;    Tie.loader("*********************", true);    </script><% } %>

在comment的配置文件themes/indigo/layout/_partial/post/comment.ejs中添加刚刚加入的评论配置文件

<%- partial('../plugins/netease') %>

最后,在主题的config文件(themes/indigo/_config.yml)中关闭duoshuo,打开neteast

duoshuo: falsenetease: true

当然,不能忘记了编译下,

hexo cleanhexo g -d

注意:部署到web端才能看到网易云评论,在localhost测试的时候一直不行,以为以为配置错误呢,尴尬…

参考

多说要关闭了,修改为使用搜狐畅言评论插件

替换多说到网易云跟帖

0 0
原创粉丝点击