Skip to content

Commit

Permalink
Merge pull request #18 from xtaodada/master
Browse files Browse the repository at this point in the history
🔌增加Disqusjs评论系统
  • Loading branch information
nexmoe committed Jul 27, 2019
2 parents 2d1b5a3 + ca9017c commit 2cf21dc
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 5 deletions.
23 changes: 21 additions & 2 deletions WIKI/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
- [Gitalk](#Gitalk)
- [Valine](#Valine)
- [Disqus](#Disqus)
- [Disqusjs](#Disqusjs)
- [搜狐畅言](#搜狐畅言)
- [来必力 livere](#%E6%9D%A5%E5%BF%85%E5%8A%9B%20livere)

## 开始

Nexmoe目前支持 6 种的评论系统,它们分别是 Gitment、Gitalk、Valine、DISQUS、搜狐畅言、来必力。
Nexmoe目前支持 7 种的评论系统,它们分别是 Gitment、Gitalk、Valine、Disqus、disqusjs、搜狐畅言、来必力。

它们分别对应的键值是 `gitment` `gitalk` `valine` `disqus` `changyan` `livere`,将你想启用的评论系统的键值填写在 `comment` 中,然后找到对应评论系统的配置位置。
它们分别对应的键值是 `gitment` `gitalk` `valine` `disqus` `disqusjs` `changyan` `livere`,将你想启用的评论系统的键值填写在 `comment` 中,然后找到对应评论系统的配置位置。

## [Gitment](https://github.com/imsun/gitment)

Expand Down Expand Up @@ -66,6 +67,24 @@ disqus:
```
如果你不知道你的 `shortname` 是什么,请访问 Disqus 中你的站点的管理后台,此时你浏览器地址栏中的域名应形如是 `example.disqus.com``example` 就是你的 `shortname`

## [Disqusjs](https://github.com/SukkaW/DisqusJS#%E9%85%8D%E7%BD%AE-disqusjs-%E5%8F%82%E6%95%B0)

这个模式下,需要用户配置一个 `https://disqus.com/api/3.0/` 的反向代理,在评论基本模式中使用反代 API 获取评论内容(但是基本模式下仍然不能发表评论)。同时提供一个按钮切换到 Disqus 完整模式下以发表评论。

>这项设置有助于在 **公开、平等、有序 的 网络审查 地区** 下的浏览者正常阅读评论内容。
```
disqusjs:
shortname: <shortname> # 你的 Disqus shortname
sitename: <sitename> # 你站点的名称,将会显示在「评论基础模式」的 header 中;该配置应该和 Disqus Admin - Settings - General - Website Name 一致
api: https://disqus.skk.moe/disqus/ # DisqusJS 请求的 API Endpoint,通常情况下你应该配置一个 Disqus API 的反代并填入反代的地址。你也可以直接使用 DISQUS 官方 API 的 Endpoint https://disqus.com/api/,或是使用SukkaW搭建的 Disqus API 反代 Endpoint https://disqus.skk.moe/disqus/。
apikey: <api_key> # DisqusJS 向 API 发起请求时使用的 API Key,你应该在配置 Disqus Application 时获取了 API Key;DisqusJS 支持填入一个 包含多个 API Key 的 Array,在每次请求时会随机使用其中一个;如果你只需要填入一个 API Key,则可以填入 String 或 Array。
admin: <admin> # 你的站点的 Disqus Moderator 的用户名(也就是你的用户名)。你可以在 Disqus - Settings - Account - Username 获取你的 Username
adminLabel: <adminLabel> # 你想显示在 Disqus Moderator Badge 中的文字。该配置应和 Disqus Admin - Settings - Community - Moderator Badge Text 相同
```

具体配置请阅读 [Disqusjs - 配置-disqusjs-参数](https://github.com/SukkaW/DisqusJS#%E9%85%8D%E7%BD%AE-disqusjs-%E5%8F%82%E6%95%B0)

## [搜狐畅言](http://changyan.kuaizhan.com/)

```
Expand Down
23 changes: 21 additions & 2 deletions WIKI/en/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
- [Gitalk](#Gitalk)
- [Valine](#Valine)
- [Disqus](#Disqus)
- [Disqusjs](#Disqusjs)
- [Sohu Changyan](#Sohu%20Changyan)
- [livere](#livere)

## Start

Nexmoe currently supports `six` review systems: Gitment, Gitalk, Valley, Disqus, Sohu Changyan, and livere.
Nexmoe currently supports `seven` review systems: Gitment, Gitalk, Valley, Disqus, Disqusjs, Sohu Changyan, and livere.

The corresponding key values are `gitment` `gitalk` `valine` `disqus` `changyan` `livere`, fill in the key of the comment system you want to enable in `comment`, and then find the configuration location of the corresponding comment system.
The corresponding key values are `gitment` `gitalk` `valine` `disqus` `disqusjs` `changyan` `livere`, fill in the key of the comment system you want to enable in `comment`, and then find the configuration location of the corresponding comment system.

## [Gitment](https://github.com/imsun/gitment)

Expand Down Expand Up @@ -66,6 +67,24 @@ disqus:
```
If you don't know what your `shortname` is, please visit the administrative background of your site in Disqus. The domain name in your browser's address bar should be like `example.disqus.com`, `example` is your `shortname`.

## [Disqusjs](https://github.com/SukkaW/DisqusJS#%E9%85%8D%E7%BD%AE-disqusjs-%E5%8F%82%E6%95%B0)

In this mode, the user needs to configure a reverse proxy of `https://disqus.com/api/3.0/` to use the anti-generation API to get the comment content in the comment basic mode (but the comment cannot be published in the basic mode). Also provide a button to switch to the full text of Disqus to post a comment.

>This setting helps viewers in **an open, equal, and orderly online review area** read the comments as they normally.
```
disqusjs:
shortname: <shortname> # Your Disqus shortname
sitename: <sitename> # The name of your site will be displayed in the header of the "Comment Based Mode"; this configuration should be consistent with the Disqus Admin - Settings - General - Website Name
api: https://disqus.skk.moe/disqus/ # The API Endpoint requested by the DisqusJS. Normally you should configure a reverse of the Disqus API and fill in the inverted address. You can also use the Endpoint https://disqus.com/api/ of the DISQUS official API directly, or use the Google API built by SukkaW to reverse Endpoint https://disqus.skk.moe/disqus/.
apikey: <api_key> # The API Key used by the companyJS to make a request to the API, you should get the API Key when configuring the Disqus application; the DisqusJS support fills in an Array containing multiple API Keys, which will be used randomly at each request; if you only Need to fill in an API Key, you can fill in String or Array.
admin: <admin> # The username of your site's Disqus Moderator (that is, your username). You can get your Username in Disqus - Settings - Account - Username
adminLabel: <adminLabel> # You want to display the text in the Disqus Moderator Badge. This configuration should be the same as the Disqus Admin - Settings - Community - Moderator Badge Text
```

Please read [Disqusjs - 配置-disqusjs-参数](https://github.com/SukkaW/DisqusJS#%E9%85%8D%E7%BD%AE-disqusjs-%E5%8F%82%E6%95%B0) for specific configuration

## [Sohu Changyan](http://changyan.kuaizhan.com/)

```
Expand Down
10 changes: 9 additions & 1 deletion _config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ analytics: # 统计系统,目前支持 Google analytics.js 统计、Google Tag
cnzz_site_id: <ID>
tencent_site_id: <ID>

comment: gitalk # 评论框,目前支持 gitalk,gitment,valine,disqus,changyan,livere
comment: gitalk # 评论框,目前支持 gitalk,gitment,valine,disqus,disqusjs,changyan,livere

gitalk:
admin: nexmoe # 拥有对该repo进行操作的 GitHub username
Expand All @@ -53,6 +53,14 @@ valine:
disqus:
shortname: <shortname> # 你的 Disqus shortname

disqusjs:
shortname: <shortname> # 你的 Disqus shortname
sitename: <sitename> # 你站点的名称,将会显示在「评论基础模式」的 header 中;该配置应该和 Disqus Admin - Settings - General - Website Name 一致
api: https://disqus.skk.moe/disqus/ # DisqusJS 请求的 API Endpoint,通常情况下你应该配置一个 Disqus API 的反代并填入反代的地址。你也可以直接使用 DISQUS 官方 API 的 Endpoint https://disqus.com/api/,或是使用SukkaW搭建的 Disqus API 反代 Endpoint https://disqus.skk.moe/disqus/。
apikey: <api_key> # DisqusJS 向 API 发起请求时使用的 API Key,你应该在配置 Disqus Application 时获取了 API Key;DisqusJS 支持填入一个 包含多个 API Key 的 Array,在每次请求时会随机使用其中一个;如果你只需要填入一个 API Key,则可以填入 String 或 Array。
admin: <admin> # 你的站点的 Disqus Moderator 的用户名(也就是你的用户名)。你可以在 Disqus - Settings - Account - Username 获取你的 Username
adminLabel: <adminLabel> # 你想显示在 Disqus Moderator Badge 中的文字。该配置应和 Disqus Admin - Settings - Community - Moderator Badge Text 相同

changyan:
appid: <APP_ID> # 畅言的 APPID
conf: <CONF> # 畅言的 CONF
Expand Down
17 changes: 17 additions & 0 deletions layout/_partial/_comment/disqusjs.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Unpkg -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/disqusjs.css">
<script src="https://unpkg.com/[email protected]/dist/disqus.js"></script>
<div id="disqus_thread"></div>
<script>
var dsqjs = new DisqusJS({
shortname: '<%= theme.disqusjs.shortname %>',
siteName: '<%= theme.disqusjs.sitename %>',
identifier: '<%= page.permalink %>',
url: '<%= page.permalink %>',
title: '<%= page.title %>',
api: '<%= theme.disqusjs.api %>',
apikey: '<%= theme.disqusjs.apikey %>',
admin: '<%= theme.disqusjs.admin %>',
adminLabel: '<%= theme.disqusjs.adminLabel %>'
});
</script>

0 comments on commit 2cf21dc

Please sign in to comment.