hexo程序员

给hexo博客添加gitment评论

2017-07-10  本文已影响141人  hojun

说起gitment全是泪啊~~~多说6月1号说拜拜,刚7月3号的时候换了网易云跟帖,今天早上就收到个坏消息:

image
好吧,我再换
参考gitment作者博客说明:https://imsun.net/posts/gitment-introduction/

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

1. 注册github OAuth Application

在头像->setting下面


image

得到owner、client_id、client_secret
注意填写:若是绑定个人域名就不能使用yourname.github.io作为Homepage URL和Authorization callback URL。gitment会报Error: Comments Not Initialized错误

2. 引入 Gitment

将下面的代码添加到你的页面:

<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报错

新建了个简书程序员交流群194472590,欢迎加入交流!

上一篇 下一篇

猜你喜欢

热点阅读