文章首次发表在: hexo加入gitment功能
Gitment 是做者实现的一款基于 GitHub Issues 的评论系统。支持在前端直接引入,不须要任何后端代码。能够在页面进行登陆、查看、评论、点赞等操做,同时有完整的 Markdown / GFM 和代码高亮支持。尤其适合各类基于 GitHub Pages 的静态博客或项目页面。前端
next(v5.1.4)
支持gitment
功能
点击https://github.com/settings/applications/new注册,注意Authorization callback URL填本身的网站url, 好比个人 https://wangyaxing.cn/git
你会获得一个 client ID 和一个 client secret,这个将用于如下的配置中github
找到gitment进行配置后端
gitment: enable: true mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway count: true # Show comments count in post meta area lazy: false # Comments lazy loading with a button cleanly: false # Hide 'Powered by ...' on footer, and more language: # Force language, or auto switch by theme github_user: Your Github ID github_repo: 新建一个代码仓库,用于存储评论内容, 这里千万注意添加仓库名称而不是完整地址 client_id: # MUST HAVE, Github client id for the Gitment client_secret: # EITHER this or proxy_gateway, Github access secret token for the Gitment
出现这个问题的缘由是由于配置ower, repo的时候错了
repo指的是仓库名称而不是仓库地址hexo
Error:validation failed
刚开始看了好多文章, 一直修改next/layout/_partials/comments.swig
, 并且还加了以下内容, 可是修改完以后一直没有起做用, 后来又查找源码, 发现V5.1.4版本和以前的不太同样, 并不用本身添加一些内容,这也是提醒你们查找解决方法时必定要注意修改的版本号app
以前的版本
如今的版本内容以下:ide
修改next/layout/_third-party/comments/gitment.swig
[图片上传失败...(image-c5fa0f-1536162212603)]post
修改ID由默认的window.location.pathname
为 page.date
解决ID长度过长报错问题网站