mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
add disqus.js
This commit is contained in:
18
_config.yml
18
_config.yml
@@ -178,16 +178,22 @@ addtoany:
|
|||||||
|
|
||||||
#### Comments System ####
|
#### Comments System ####
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
|
# Disqus 官方版評論系統
|
||||||
# Disqus.js 版评论系统,应对大陆长城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS
|
|
||||||
# API 申请地址:https://disqus.com/api/applications/
|
|
||||||
disqus:
|
disqus:
|
||||||
enable: false #开启改为 true
|
enable: false
|
||||||
|
shortname:
|
||||||
|
count: false # top_img顯示評論數
|
||||||
|
|
||||||
|
# Disqus.js 版評論系統,應對大陸長城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS
|
||||||
|
# API 申請地址:https://disqus.com/api/applications/
|
||||||
|
# 與 disqus 共用樣式
|
||||||
|
disqusjs:
|
||||||
|
enable: false #開啓改爲 true
|
||||||
shortname:
|
shortname:
|
||||||
siteName:
|
siteName:
|
||||||
apikey:
|
apikey:
|
||||||
api: https://disqus.skk.moe/disqus/ #一般情况无需要修改
|
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
|
||||||
count: true # top_img顯示評論數
|
count: false # top_img顯示評論數
|
||||||
|
|
||||||
laibili:
|
laibili:
|
||||||
enable: false
|
enable: false
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
if theme.disqus && theme.disqus.enable
|
if theme.disqus && theme.disqus.enable
|
||||||
#disqus_thread
|
#disqus_thread
|
||||||
link(href=('https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqusjs.css') rel='stylesheet')
|
|
||||||
script(src=('https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqus.js'))
|
|
||||||
script.
|
script.
|
||||||
var dsqjs = new DisqusJS({
|
var unused = null;
|
||||||
shortname: '!{theme.disqus.shortname}',
|
var disqus_config = function () {
|
||||||
siteName: "!{theme.disqus.siteName}",
|
this.page.url = '!{ page.permalink }';
|
||||||
identifier: '!{ page.path }',
|
this.page.identifier = '!{ page.path }';
|
||||||
url: '!{ page.permalink }',
|
this.page.title = '!{ page.title }';
|
||||||
title: '!{ page.title }',
|
}
|
||||||
api: '!{theme.disqus.api}',
|
var d = document, s = d.createElement('script');
|
||||||
apikey: '!{theme.disqus.apikey}',
|
s.src = "https://" + '!{theme.disqus.shortname}' +".disqus.com/embed.js";
|
||||||
admin: '',
|
s.setAttribute('data-timestamp', '' + +new Date());
|
||||||
adminLabel: ''
|
(d.head || d.body).appendChild(s);
|
||||||
});
|
|
||||||
16
layout/includes/comments/disqusjs.pug
Normal file
16
layout/includes/comments/disqusjs.pug
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
if theme.disqusjs && theme.disqusjs.enable
|
||||||
|
#disqus_thread
|
||||||
|
link(href=('https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqusjs.css') rel='stylesheet')
|
||||||
|
script(src=('https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqus.js'))
|
||||||
|
script.
|
||||||
|
var dsqjs = new DisqusJS({
|
||||||
|
shortname: '!{theme.disqusjs.shortname}',
|
||||||
|
siteName: "!{theme.disqusjs.siteName}",
|
||||||
|
identifier: '!{ page.path }',
|
||||||
|
url: '!{ page.permalink }',
|
||||||
|
title: '!{ page.title }',
|
||||||
|
api: '!{theme.disqusjs.api}',
|
||||||
|
apikey: '!{theme.disqusjs.apikey}',
|
||||||
|
admin: '',
|
||||||
|
adminLabel: ''
|
||||||
|
});
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
- var d = theme.disqus && theme.disqus.enable
|
- var d = theme.disqus && theme.disqus.enable
|
||||||
|
- var dj = theme.disqusjs && theme.disqusjs.enable
|
||||||
- var l = theme.laibili && theme.laibili.enable
|
- var l = theme.laibili && theme.laibili.enable
|
||||||
- var gt = theme.gitalk && theme.gitalk.enable
|
- var gt = theme.gitalk && theme.gitalk.enable
|
||||||
- var v = theme.valine && theme.valine.enable
|
- var v = theme.valine && theme.valine.enable
|
||||||
|
|
||||||
if d || l || gt || v
|
if d || dj || l || gt || v
|
||||||
hr
|
hr
|
||||||
#post-comment
|
#post-comment
|
||||||
.comment_headling
|
.comment_headling
|
||||||
@@ -11,6 +12,8 @@ if d || l || gt || v
|
|||||||
span= ' ' + _p('comment')
|
span= ' ' + _p('comment')
|
||||||
if d
|
if d
|
||||||
include ./disqus.pug
|
include ./disqus.pug
|
||||||
|
else if dj
|
||||||
|
include ./disqusjs.pug
|
||||||
else if l
|
else if l
|
||||||
include ./laibili.pug
|
include ./laibili.pug
|
||||||
else if gt
|
else if gt
|
||||||
|
|||||||
Reference in New Issue
Block a user