[feat] add waline v3
This commit is contained in:
parent
575fc5fef0
commit
8f61d81eef
|
@ -208,7 +208,7 @@ comments:
|
||||||
css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline.css
|
css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline.css
|
||||||
meta_css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline-meta.css
|
meta_css: https://gcore.jsdelivr.net/npm/@waline/client@3.1.2/dist/waline-meta.css
|
||||||
# Waline server address url, you should set this to your own link
|
# Waline server address url, you should set this to your own link
|
||||||
serverURL:
|
serverURL: https://waline.vercel.app
|
||||||
# If false, comment count will only be displayed in post page, not in home page
|
# If false, comment count will only be displayed in post page, not in home page
|
||||||
commentCount: true
|
commentCount: true
|
||||||
# Pageviews count, Note: You should not enable both `waline.pageview` and `leancloud_visitors`.
|
# Pageviews count, Note: You should not enable both `waline.pageview` and `leancloud_visitors`.
|
||||||
|
@ -243,10 +243,6 @@ comments:
|
||||||
# token: # 图床验证
|
# token: # 图床验证
|
||||||
# resp: # 图片地址返回值的字段
|
# resp: # 图片地址返回值的字段
|
||||||
|
|
||||||
waline_v3:
|
|
||||||
# Waline server address url, you should set this to your own link
|
|
||||||
serverURL: https://waline.vercel.app
|
|
||||||
|
|
||||||
# Artalk
|
# Artalk
|
||||||
# https://artalk.js.org/
|
# https://artalk.js.org/
|
||||||
artalk:
|
artalk:
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
<%
|
|
||||||
function layoutDiv() {
|
|
||||||
var el = ''
|
|
||||||
el += '<div id="waline_container" class="waline_thread"'
|
|
||||||
const cfg = theme.comments['waline_v3']
|
|
||||||
var attrs = {}
|
|
||||||
if (page.comment_id) {
|
|
||||||
attrs['comment_id'] = page.comment_id
|
|
||||||
}
|
|
||||||
// 参数在这里进行传递
|
|
||||||
attrs.serverURL = cfg?.serverURL
|
|
||||||
|
|
||||||
for (let key of Object.keys(attrs)) {
|
|
||||||
if (attrs[key]) {
|
|
||||||
el += ' ' + key + '="' + attrs[key] + '"'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
el += `>${icon('default:loading')}</div>`
|
|
||||||
return el
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<%- layoutDiv() %>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<script defer type="module">
|
|
||||||
import { init } from 'https://unpkg.com/@waline/client@v3/dist/waline.js';
|
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
|
||||||
utils.css('https://unpkg.com/@waline/client@v3/dist/waline.css');
|
|
||||||
const id = 'waline_container';
|
|
||||||
const el = document.getElementById(id);
|
|
||||||
var path = el.getAttribute('comment_id');
|
|
||||||
if (!path) {
|
|
||||||
path = decodeURI(window.location.pathname);
|
|
||||||
}
|
|
||||||
const waline = init({
|
|
||||||
el: `#${id}`,
|
|
||||||
path: path,
|
|
||||||
serverURL: el.getAttribute('serverURL'),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -28,7 +28,5 @@ if hexo-config('comments.service') == 'utterances'
|
||||||
@import 'comments/utterances'
|
@import 'comments/utterances'
|
||||||
if hexo-config('comments.service') == 'waline'
|
if hexo-config('comments.service') == 'waline'
|
||||||
@import 'comments/waline'
|
@import 'comments/waline'
|
||||||
if hexo-config('comments.service') == 'waline_v3'
|
|
||||||
@import 'comments/waline'
|
|
||||||
if hexo-config('comments.service') == 'artalk'
|
if hexo-config('comments.service') == 'artalk'
|
||||||
@import 'comments/artalk'
|
@import 'comments/artalk'
|
||||||
|
|
Loading…
Reference in New Issue