add disqus.js

This commit is contained in:
eallion
2019-12-28 13:17:57 +08:00
parent d59ed0b401
commit 894c709b3c
4 changed files with 42 additions and 20 deletions

View File

@@ -1,16 +1,13 @@
if theme.disqus && theme.disqus.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.disqus.shortname}',
siteName: "!{theme.disqus.siteName}",
identifier: '!{ page.path }',
url: '!{ page.permalink }',
title: '!{ page.title }',
api: '!{theme.disqus.api}',
apikey: '!{theme.disqus.apikey}',
admin: '',
adminLabel: ''
});
var unused = null;
var disqus_config = function () {
this.page.url = '!{ page.permalink }';
this.page.identifier = '!{ page.path }';
this.page.title = '!{ page.title }';
}
var d = document, s = d.createElement('script');
s.src = "https://" + '!{theme.disqus.shortname}' +".disqus.com/embed.js";
s.setAttribute('data-timestamp', '' + +new Date());
(d.head || d.body).appendChild(s);

View 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: ''
});

View File

@@ -1,9 +1,10 @@
- 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
@@ -11,6 +12,8 @@ if d || l || gt || v
span= ' ' + _p('comment')
if d
include ./disqus.pug
else if dj
include ./disqusjs.pug
else if l
include ./laibili.pug
else if gt