Skip to content

Commit

Permalink
feat: 新增 Artalk 评论系统
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepChirp committed Oct 14, 2024
1 parent 568cbf8 commit 9ef2588
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
11 changes: 10 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,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 | discuss
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss | artalk
type: disqus


Expand Down Expand Up @@ -912,6 +912,13 @@ discuss:
serverURLs:
path: window.location.pathname

# Artalk
# 由 Golang 驱动的自托管评论系统
# Self-hosted commenting system driven by Golang
# See: https://artalk.js.org
artalk:
server:
site:

#---------------------------
# 归档页
Expand Down Expand Up @@ -1124,6 +1131,8 @@ static_prefix:

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

artalk: https://lib.baomitu.com/artalk/2.9.0/

hint: https://lib.baomitu.com/hint.css/2.7.0/

moment: https://lib.baomitu.com/moment.js/2.29.4/
27 changes: 27 additions & 0 deletions layout/_partials/comments/artalk.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<% if (theme.artalk && theme.artalk.server) { %>
<div id="artalk"></div>
<script type="text/javascript">
Fluid.utils.loadComments('#comments', function() {
Fluid.utils.createCssLink('<%= url_join(theme.static_prefix.artalk, 'Artalk.min.css') %>');
Fluid.utils.createScript('<%= url_join(theme.static_prefix.artalk, 'Artalk.min.js') %>', function() {
var schema = document.documentElement.getAttribute('data-user-color-scheme');
if (schema !== 'light' && schema !== 'dark') {
schema = 'light';
}
var options = Object.assign(
<%- JSON.stringify(theme.artalk || {}) %>,
{
el: document.querySelector('#artalk'),
pageKey: '<%= page.permalink %>',
pageTitle: '<%= page.title %>',
server: '<%= theme.artalk.server %>',
site: '<%= theme.artalk.site %>',
darkMode: schema === 'dark'
}
)
Artalk.init(options)
});
});
</script>
<noscript>Please enable JavaScript to view the comments</noscript>
<% } %>

0 comments on commit 9ef2588

Please sign in to comment.