Hexo博客yilia主题添加Gitment评论系统

gitment是imsun利用github上的issues做的评论系统,我这里大力推荐,原因有三:

  1. 注册简单,只要填写APP名和主页地址
  2. 实现方便,只要简单的配置
  3. 没有广告,这个很重要

注册OAuth Application

注册网址: https://github.com/settings/applications/new
Hexo博客yilia主题添加Gitment评论系统

Application name:博客名字
Homepage URL; 网站主页地址(这里我填写的是域名/index.html大部分的默认网页都是index.html)
Application description:描述,选填
Authorization callback URL: 填写域名就行了
填写完毕后点击Register application 跳转到另外一个界面,这里可以得到一个
Client ID和Client Secret

Hexo博客yilia主题添加Gitment评论系统

修改_config.yml

注意这里的_config.yml是主题下的配置文件,不是全局的

#5、Gitment
gitment_owner: javacfox       #你的 GitHub ID
gitment_repo: 'javacfox.github.io'          #存储评论的 repo
gitment_oauth:
  client_id: '23e433c3cfc76c050ba3'           #client ID
  client_secret: '697e555db09c2e181f24fbe071de2e02156dc255'       #client secret

评论配置

打开你的blog本地仓库themes\yilia\layout_partial\post\gitment.ejs将

<link rel="stylesheet" href="//imsun.github.io/gitment/style/default.css">
<script src="//imsun.github.io/gitment/dist/gitment.browser.js"></script>

修改为:

<link rel="stylesheet" href="https://jjeejj.github.io/css/gitment.css">
<script src="https://www.wenjunjiang.win/js/gitment.js"></script>

验证是否配置成功

在游览器界面输入http://localhost:4000/,检测有没有评论界面
Hexo博客yilia主题添加Gitment评论系统
如果有这个界面就可以了,如果没有,那么可能是你没有配置好