add livere comment plugin support (#274)

This commit is contained in:
hidennis 2017-08-14 22:38:49 +08:00 committed by Ruipeng Zhang
parent 9ed876f49e
commit 451198931d
5 changed files with 29 additions and 0 deletions

View File

@ -64,6 +64,7 @@ comment:
#Register an OAuth application, and you will get a client ID and a client secret.
client_id: #your client ID
client_secret: #your client secret
livere: # enter livere uid here
# Share
share: default # options: jiathis, bdshare, addtoany, default

View File

@ -11,5 +11,7 @@
<a href="<%= post.permalink %>#comments" class="article-comment-link"><span class="fb-comments-count" data-href="<%= post.permalink %>">0</span>&nbsp;<%= __('article.comments') %></a>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<a href="<%= post.permalink %>#comments" id="sourceId::<%= post.path %>" class="article-comment-link cy_cmt_count"><%= __('article.comments') %></a>
<% } else if (theme.comment.livere) { %>
<a href="<%- post.permalink %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<% } %>
<% } %>

View File

@ -11,6 +11,8 @@
<section id="comments"><%- partial('comment/isso') %></section>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<section id="comments"><%- partial('comment/changyan') %></section>
<% } else if (theme.comment.livere) { %>
<section id="comments"><%- partial('comment/livere') %></section>
<% } else if (theme.comment.gitment) { %>
<section id="comments"><%- partial('comment/gitment') %></section>
<% } %>

22
layout/comment/livere.ejs Normal file
View File

@ -0,0 +1,22 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<!-- 来必力City版安装代码 -->
<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>
<!-- City版安装代码已完成 -->
<% } else { %>
<div id="lv-container" data-id="city" data-uid=<%= theme.comment.livere %>></div>
<% } %>

View File

@ -16,4 +16,6 @@
theme.comment.gitment.client_id &&
theme.comment.gitment.client_secret) { %>
<%- partial('comment/gitment', { script: true }) %>
<% } else if (theme.comment.livere) { %>
<%- partial('comment/livere', { script: true }) %>
<% } %>