IkeqIkeq

The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts.

Inside 主题配置 - Plugins

Feb 1, 2019

Disqus

主题内置 Disqus

1
2
3
4
5
6
7
8
9
comments:
# Disqus
disqus:
# disqus shortname
shortname:
# disqus 脚本 URL,缺省值 `//shortname.disqus.com/embed.js`
script:
# 自动加载或显示为手动加载按钮,缺省值 `true`。
autoload:

其他评论系统

其他评论系统集成通过 plugins 实现。

Valine

_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
plugins:
- //cdn1.lncld.net/static/js/3.0.4/av-min.js
- //unpkg.com/valine/dist/Valine.min.js
- position: comments
template: |
<div id="vcomment"></div>
<script>
new Valine({
el: '#vcomment',
appId: '<API_ID>',
appKey: '<API_Key>',
path: location.pathname
})
</script>

Twikoo

_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
plugins:
- //cdn.jsdelivr.net/npm/twikoo@1.4.1/dist/twikoo.all.min.js
- position: comments
template: |
<div id="tcomment"></div>
<script>
window.twikoo && twikoo.init({
envId: '您的环境id',
el: '#tcomment',
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai,如果您的环境地域不是上海,需传此参数
// path: 'window.location.pathname', // 用于区分不同文章的自定义 js 路径,如果您的文章路径不是 location.pathname,需传此参数
})
</script>

Gitment

_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
plugins:
- //imsun.github.io/gitment/style/default.css
- //imsun.github.io/gitment/dist/gitment.browser.js
- position: comments
template: |
<div id="gitment"></div>
<script>
if (!window.__gitment) window.__gitment = new Gitment({
owner: 'Your GitHub ID',
repo: 'The repo to store comments',
oauth: {
client_id: 'Your client ID',
client_secret: 'Your client secret',
},
});
Object.assign(__gitment, {
id: decodeURIComponent(location.pathname),
title: document.title,
link: location.href,
});
__gitment.update();
__gitment.render('gitment');
</script>

See also

Buy me a cup of milk 🥛.