增加Artalk评论

This commit is contained in:
李亮亮 2024-01-16 13:32:25 +08:00
parent afee0b2ba5
commit e0fbe04d7d
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<%
const {
server,
site
} = theme.comment?.artalk
let cdn_css = '//cdnjs.cloudflare.com/ajax/libs/artalk/2.7.3/Artalk.css'
let cdn_js = '//cdnjs.cloudflare.com/ajax/libs/artalk/2.7.3/Artalk.js'
%>
<% if(server && site) { %>
<div class="artalk-comment-container">
<div id="artalk-container"></div>
<link rel="stylesheet" href="<%= cdn_css %>">
<script src="<%= cdn_js %>"></script>
<script >
function loadArtalk() {
Artalk.init({
el: '#artalk-container',
server: '<%= server %>',
site: '<%= site %>',
})
}
const loadArtalkTimeout = setTimeout(() => {
loadArtalk();
clearTimeout(loadArtalkTimeout);
}, 1000);
</script>
</div>
<% } %>

View File

@ -22,6 +22,9 @@ const {
<% } else if (t_comment_use === 'waline') { %> <% } else if (t_comment_use === 'waline') { %>
<%- partial('waline') %> <%- partial('waline') %>
<% } else if (t_comment_use === 'artalk') { %>
<%- partial('artalk') %>
<% } %> <% } %>
<% } %> <% } %>
</div> </div>