说起gitment全是泪啊~~~多说6月1号说拜拜,刚7月三号的时候换了网易云跟帖,今天早上就收到个坏消息:
006bYVyvgy1fhf69hzfxej30ip09lmxs.jpg
好吧,我再换
参考gitment作者博客说明:https://imsun.net/posts/gitment-introduction/

概括下使用说明 就两步就行 超简单

1. 注册github OAuth Application

在头像->setting下面
006bYVyvgy1fhf7a6r8ykj30jy0lcac0.jpg
得到owner、client_id、client_secret

注意填写:若是绑定个人域名就不能使用yourname.github.io作为Homepage URL和Authorization callback URL。gitment会报Error: Comments Not Initialized错误
### 2. 引入 Gitment
将下面的代码添加到你的页面:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div id="container"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: '页面 ID', // 可选。默认为 location.href
owner: '你的 GitHub ID',
repo: '存储评论的 repo',
oauth: {
client_id: '你的 client ID',
client_secret: '你的 client secret',
},
})
gitment.render('container')


注意填写:参数错误会出现Error: Not Found报错
  • id可以直接删掉
  • repo只要填你的仓库名称就行,不用仓库的git或ssh。例如我的 repo: ‘honjun.github.io’,
  • id=”container”和gitment.render(‘container’)最好改下,比如gitment-container以防id重复

希望这篇文章能给你带来知识和乐趣,喜欢博主的文章可以加博主好友哦

有好的文章也可以向博主投稿哦