BlueLake主题增加gitment评论

1.注册 OAuth Application

点击此处 来注册一个新的 OAuth Application。其他内容可以随意填写,但要确保填入正确的 callback URL(一般是评论页面对应的域名)。
如果使用的github地址跳转到http://tommy88.top,则填写http://tommy88.top

你会得到一个 client ID 和一个 client secret,这个将被用于之后的用户登录。

2.在BlueLake主题的_config.yml中增加gitment的配置

gitment:
  enable: true # 是否开启gitment评论系统
  mint: true #
  count: true # 是否显示评论数
  lazy: true # 懒加载,设置为ture时需手动展开评论
  cleanly: true # 是否隐藏'Powered by ...'
  language: en # 语言,置空则随主题的语言
  github_user: luckystar88 # Github用户名
  github_repo: comments # 在Github新建一个仓库用于存放评论,这是仓库名
  client_id: beecde0acb47cc10965c # 注册OAuth Application时生成
  client_secret: 2a7655badd4d1e416000abc4b0676e5c70577f # 注册OAuth Application时生成
  proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect
  redirect_protocol: # Protocol of redirect_uri with force_redirect_protocol when mint enabled

3.在comments_js.jade中增加gitment配置

if theme.gitment.enable
  link(rel='stylesheet',href='https://imsun.github.io/gitment/style/default.css')
  script(src='https://imsun.github.io/gitment/dist/gitment.browser.js')
  script.
    var gitment = new Gitment({
      id: '#{page.path}', // 可选。默认为 location.href
      owner: '#{theme.gitment.github_user}',
      repo: '#{theme.gitment.github_repo}',
      oauth: {
        client_id: '#{theme.gitment.client_id}',
        client_secret: '#{theme.gitment.client_secret}',
      },
    });
    gitment.render('comments')

注意:BlueLake主题使用的容器是base.jade中的id=comments的div,所以这里gitment.render的id不是自己创建的容器。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值