hexo-theme-diaspora icon indicating copy to clipboard operation
hexo-theme-diaspora copied to clipboard

可否考虑接入valine评论系统,gitalk太不稳定了

Open AnfengLee opened this issue 4 years ago • 2 comments

URL: Description:

AnfengLee avatar Mar 24 '20 06:03 AnfengLee

魔改主题中有关gitalk的代码即可 1.diaspora\layout_partial\post\gitalk.ejs中的代码全部删除,替换为 <div id="gitalk-container" class="comment link">加载评论</div> 2.diaspora\layout_partial\scripts.ejs中的第一行替换为 <% if (theme.gitalk.enable){ %><%- js(['/Valine.min.js'])%><%}%>

(我是将Valine.min.js放置在博客根目录)

3.diaspora\source\js\diaspora.js,找到case - 1 != tag.indexOf("comment"):,将下面if与else中的代码全部删除,替换为以下代码: if($('#gitalk-container').data('enable') == true){ Diaspora.loading(), comment = $('#gitalk-container'); gitalk = new Valine({ el: '#gitalk-container' , appId: '你的Leancloud APPID', appKey: '你的Leancloud APPKEY', notify:false, # 有人回复时的通知 verify:true, # 回复时的验证码 avatar:'robohash', placeholder: '到此一游' }) $(".comment").removeClass("link") gitalk.render('gitalk-container') Diaspora.loaded(); }else{ Diaspora.loading(), comment = $('#gitalk-container'); gitalk = new Valine({ el: '#gitalk-container' , appId: '你的Leancloud APPID', appKey: '你的Leancloud APPKEY', notify:false, # 有人回复时的通知 verify:true, # 回复时的验证码 avatar:'robohash', placeholder: '到此一游' }) $(".comment").removeClass("link") gitalk.render('gitalk-container') Diaspora.loaded(); }

CCJohny avatar Apr 10 '20 06:04 CCJohny

@CCJohny 大佬,修改完出现了所有文章共用一个评论区的现象如何修改啊

XuanMiaoSama avatar Apr 10 '22 05:04 XuanMiaoSama