Skip to content

Commit

Permalink
Merge pull request jerryc127#90 from eallion/dev
Browse files Browse the repository at this point in the history
修改 Disqus 为 Disqus.js 版
  • Loading branch information
jerryc127 authored Dec 28, 2019
2 parents 43b109b + 894c709 commit ae717bd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
12 changes: 12 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,23 @@ addtoany:

#### Comments System ####
# ------------------------------------
# Disqus 官方版評論系統
disqus:
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:
siteName:
apikey:
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
count: false # top_img顯示評論數

laibili:
enable: false
uid:
Expand Down
16 changes: 16 additions & 0 deletions layout/includes/comments/disqusjs.pug
Original file line number Diff line number Diff line change
@@ -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: ''
});
5 changes: 4 additions & 1 deletion layout/includes/comments/index.pug
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
- var d = theme.disqus && theme.disqus.enable
- var dj = theme.disqusjs && theme.disqusjs.enable
- var l = theme.laibili && theme.laibili.enable
- var gt = theme.gitalk && theme.gitalk.enable
- var v = theme.valine && theme.valine.enable

if d || l || gt || v
if d || dj || l || gt || v
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment')
if d
include ./disqus.pug
else if dj
include ./disqusjs.pug
else if l
include ./laibili.pug
else if gt
Expand Down

0 comments on commit ae717bd

Please sign in to comment.