Skip to content

Commit

Permalink
✨ 新增 discuss 评论插件
Browse files Browse the repository at this point in the history
  • Loading branch information
Lete114 authored and zkqiang committed Jun 10, 2023
1 parent 28a3776 commit 60b3883
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
15 changes: 13 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ post:
enable: false
# 指定的插件,需要同时设置对应插件的必要参数
# The specified plugin needs to set the necessary parameters at the same time
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss
type: disqus


Expand Down Expand Up @@ -877,6 +877,15 @@ giscus:
input-position: top
lang: zh-CN

# Discuss
# 多平台、多数据库、自托管、免费开源评论系统
# Self-hosted, small size, multi-platform, multi-database, free and open source commenting system
# See: https://discuss.js.org
discuss:
serverURLs:
path: window.location.pathname


#---------------------------
# 归档页
# Archive Page
Expand Down Expand Up @@ -1027,7 +1036,7 @@ links:
enable: false
# 指定的插件,需要同时设置对应插件的必要参数
# The specified plugin needs to set the necessary parameters at the same time
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss
type: disqus


Expand Down Expand Up @@ -1086,4 +1095,6 @@ static_prefix:

twikoo: https://lib.baomitu.com/twikoo/1.6.8/

discuss: https://lib.baomitu.com/discuss/1.2.1/

hint: https://lib.baomitu.com/hint.css/2.7.0/
17 changes: 17 additions & 0 deletions layout/_partials/comments/discuss.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<% if (theme.discuss && theme.discuss.serverURLs) { %>
<div id="discuss-comments"></div>
<script type="text/javascript">
Fluid.utils.loadComments('#comments', function() {
Fluid.utils.createScript('<%= url_join(theme.static_prefix.discuss, 'discuss.js') %>', function() {
var options = Object.assign(
<%- JSON.stringify(theme.discuss || {}) %>,
{ el: '#discuss-comments',
path: <%= theme.discuss.path %>
}
)
discuss.init(options)
});
});
</script>
<noscript>Please enable JavaScript to view the comments</noscript>
<% } %>

0 comments on commit 60b3883

Please sign in to comment.