diff --git a/_config.yml b/_config.yml index 090224b..56f4ccd 100644 --- a/_config.yml +++ b/_config.yml @@ -178,10 +178,16 @@ addtoany: #### Comments System #### # ------------------------------------ + +# Disqus.js 版评论系统,应对大陆长城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS +# API 申请地址:https://disqus.com/api/applications/ disqus: - enable: false - shortname: - count: false # top_img顯示評論數 + enable: false #开启改为 true + shortname: + siteName: + apikey: + api: https://disqus.skk.moe/disqus/ #一般情况无需要修改 + count: true # top_img顯示評論數 laibili: enable: false diff --git a/layout/includes/comments/disqus.pug b/layout/includes/comments/disqus.pug index 1e0c01c..b53f95a 100644 --- a/layout/includes/comments/disqus.pug +++ b/layout/includes/comments/disqus.pug @@ -1,13 +1,16 @@ 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 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); \ No newline at end of file + 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: '' + }); \ No newline at end of file