feat: add changyan comment plugin

This commit is contained in:
ppoffice 2017-04-12 23:14:25 +08:00
parent 7c1b6fa073
commit e4690e79a3
5 changed files with 21 additions and 0 deletions

View File

@ -55,6 +55,9 @@ comment:
youyan: # enter youyan uid here youyan: # enter youyan uid here
facebook: # enter true to enable facebook: # enter true to enable
isso: # enter the domain name of your own comment isso server eg. comments.example.com isso: # enter the domain name of your own comment isso server eg. comments.example.com
changyan: # please fill in `appid` and `conf` to enable
appid:
conf:
# Share # Share
share: default # options: jiathis, bdshare, addtoany, default share: default # options: jiathis, bdshare, addtoany, default

View File

@ -0,0 +1,12 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=<%= theme.comment.changyan.appid %>"></script>
<script charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/changyan.js" ></script>
<script type="text/javascript">
window.changyan.api.config({
appid: '<%= theme.comment.changyan.appid %>',
conf: '<%= theme.comment.changyan.conf %>'
});
</script>
<% } else { %>
<div id="SOHUCS" sid="<%= post.path %>"></div>
<% } %>

View File

@ -9,5 +9,7 @@
<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.facebook) { %> <% } 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> <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>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -10,6 +10,8 @@
<%- partial('comment/facebook') %> <%- partial('comment/facebook') %>
<% } else if (theme.comment.isso) { %> <% } else if (theme.comment.isso) { %>
<%- partial('comment/isso') %> <%- partial('comment/isso') %>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<%- partial('comment/changyan') %>
<% } %> <% } %>
</section> </section>
<% } %> <% } %>

View File

@ -8,4 +8,6 @@
<%- partial('comment/facebook', { script: true }) %> <%- partial('comment/facebook', { script: true }) %>
<% } else if (theme.comment.isso) { %> <% } else if (theme.comment.isso) { %>
<%- partial('comment/isso', { script: true }) %> <%- partial('comment/isso', { script: true }) %>
<% } else if (theme.comment.changyan && theme.comment.changyan.appid && theme.comment.changyan.conf) { %>
<%- partial('comment/changyan', { script: true }) %>
<% } %> <% } %>