gitalk的评论存储在github的仓库中,具体使用如下:

安装

1
npm i --save gitalk

去Github注册一个应用

点击进行注册 ,如下

注册应用

注册完后,可得到 Client IDClient Secret

创建评论的仓库

仓库名为xxx.github.io,xxx随便起

添加代码

1
2
3
4
5
6
7
8
9
10
11
12
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
const gitalk = new Gitalk({
clientID: 'GitHub Application Client ID',
clientSecret: 'GitHub Application Client Secret',
repo: 'xxx.github.io, // The repository of store comments,
owner: 'GitHub repo owner',
admin: ['GitHub repo owner and collaborators, only these guys can initialize github issues'],
id: location.pathname, // Ensure uniqueness and length less than 50
distractionFreeMode: false // Facebook-like distraction free mode
})
gitalk.render('gitalk-container')