Next8.x配置gitalk

升级Hexo和Next版本后 发现gitalk总是挂掉 阅读了Next的文档后 发现gitalk配置方式进行了更新 所以此文为Hexo-Next主题配置gitalk这篇文章的升级版本 读者可根据自己Next的主题版本自行取用

前提准备

有存放gitalk的issue的仓库 有创建OAuth的接口 并且记住Client Id Client secret

配置config.yml

Next8.x版本起 不需要我们自己再去写md5.js及其余swig格式文件 新版本已经将gitalk完全集成在了Next中 只需要改变config中的配置信息即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
gitalk:
enable: true
github_id: shaoyuanhangyes # GitHub repo owner
repo: gitalk # Repository name to store issues
client_id: 0432***********84e6 #GitHub Application Client ID
client_secret: 1f57***********1aad # GitHub Application Client Secret
admin_user: shaoyuanhangyes # GitHub repo owner and collaborators, only these guys can initialize gitHub issues
distraction_free_mode: true # Facebook-like distraction free mode
# When the official proxy is not available, you can change it to your own proxy address
proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token # This is official proxy adress
# Gitalk's display language depends on user's browser or system environment
# If you want everyone visiting your site to see a uniform language, you can set a force language value
# Available values: en | es-ES | fr | ru | zh-CN | zh-TW
language:

因为经常出现请求失败403等问题 gitalk作者给出了相应的解决方法 即proxy替换为
https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token

npm安装gitalk

在bolg文件夹下

1
npm i --save gitalk

配置完成

经过以上操作 gitalk即可使用 不要忘记hexo clean && hexo g -d

End of reading! -- Thanks for your supporting