feat: add isso and facebook comment plugin

This commit is contained in:
ppoffice 2017-03-07 22:25:08 +08:00
parent d961446f3f
commit 14f4664043
6 changed files with 34 additions and 1 deletions

View File

@ -53,6 +53,8 @@ comment:
disqus: hexo-theme-icarus # enter disqus shortname here disqus: hexo-theme-icarus # enter disqus shortname here
duoshuo: # enter duoshuo shortname here duoshuo: # enter duoshuo shortname here
youyan: # enter youyan uid here youyan: # enter youyan uid here
facebook: # enter true to enable
isso: # enter the domain name of your own comment isso server eg. comments.example.com
# Share # Share
share: default # options: jiathis, bdshare, addtoany, default share: default # options: jiathis, bdshare, addtoany, default

View File

@ -5,5 +5,9 @@
<a href="<%- post.permalink %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.permalink %>"><%= __('article.comments') %></a> <a href="<%- post.permalink %>#comments" class="article-comment-link ds-thread-count" data-thread-key="<%= post.permalink %>"><%= __('article.comments') %></a>
<% } else if (theme.comment.youyan) { %> <% } else if (theme.comment.youyan) { %>
<a href="<%- post.permalink %>#comments" class="article-comment-link"><%= __('article.comments') %></a> <a href="<%- post.permalink %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<% } else if (theme.comment.isso) { %>
<a href="<%= post.permalink %>#comments" class="article-comment-link"><%= __('article.comments') %></a>
<% } else if (theme.comment.facebook) { %>
<a href="<%= post.permalink %>#comments" class="article-comment-link"><span class="fb-comments-count" data-href="<%= post.permalink %>">0</span>&nbsp;<%= __('article.comments') %></a>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -0,0 +1,11 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/<%= config.language ? config.language.split('-').join('_') : 'en' %>/sdk.js#xfbml=1&version=v2.8";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<% } else { %>
<div class="fb-comments" data-width="100%" data-href="<%= page.permalink %>" data-num-posts="5"></div>
<% } %>

View File

@ -6,6 +6,10 @@
<%- partial('comment/duoshuo') %> <%- partial('comment/duoshuo') %>
<% } else if (theme.comment.youyan) { %> <% } else if (theme.comment.youyan) { %>
<%- partial('comment/youyan') %> <%- partial('comment/youyan') %>
<% } else if (theme.comment.facebook) { %>
<%- partial('comment/facebook') %>
<% } else if (theme.comment.isso) { %>
<%- partial('comment/isso') %>
<% } %> <% } %>
</section> </section>
<% } %> <% } %>

8
layout/comment/isso.ejs Normal file
View File

@ -0,0 +1,8 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<script data-isso="//<%= theme.comment.isso %>"
src="//<%= theme.comment.isso %>/js/embed.min.js">
</script>
<% } else { %>
<section id="isso-thread"></section>
<% } %>

View File

@ -4,4 +4,8 @@
<%- partial('comment/duoshuo', { script: true }) %> <%- partial('comment/duoshuo', { script: true }) %>
<% } else if (theme.comment.youyan) { %> <% } else if (theme.comment.youyan) { %>
<%- partial('comment/youyan', { script: true }) %> <%- partial('comment/youyan', { script: true }) %>
<% } else if (theme.comment.facebook) { %>
<%- partial('comment/facebook', { script: true }) %>
<% } else if (theme.comment.isso) { %>
<%- partial('comment/isso', { script: true }) %>
<% } %> <% } %>