Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(comments): 新增 discuss 评论系统 #810

Merged
merged 2 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,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 @@ -881,6 +881,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 @@ -1031,7 +1040,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 @@ -1090,4 +1099,6 @@ static_prefix:

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

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

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>
<% } %>