Hexo 集成 Gitalk 评论系统

什么是 Gitalk

Gitalk 利用了 GithubAPI 基于 GitHub Issue 和 Preact 开发的评论插件,
官方网址: https://gitalk.github.io
官方中文文档: https://github.com/gitalk/gitalk/blob/master/readme-cn.md

Gitalk 特性

1、使用 GitHub 登录  
2、支持多语言 [en, zh-CN, zh-TW, es-ES, fr, ru]
3、支持个人或组织  
4、无干扰模式(设置 distractionFreeMode 为 true 开启)  
5、快捷键提交评论 (cmd|ctrl + enter)

集成流程

Hexo主题基本都继承Gitalk我们只需在在github上面注册对应的秘钥填入hexo主题的_config.yml配置即可。

**1、在GitHub上注册新应用,链接:https://github.com/settings/applications/new **

alt

参数说明:
Application name: # 应用名称,随意
Homepage URL: # 网站URL,如https://www.tiance.club
Application description # 描述,随意
Authorization callback URL:# 网站URL,https://www.tiance.club

点击注册后,页面跳转如下,其中Client ID和Client Secret在后面的配置中需要用到,到时复制粘贴即可:
alt

2、申请一个仓库做评论存储
alt

需要记住的是仓库名,到时需要填入hexo的_config.yml配置中

3、打开对应hexo主题的_config.yml添加如下内容:
gitalk:
enable: true
githubID: github帐号 # 例:asdfv1929
repo: 仓库名称   # 例:blog
ClientID: Client ID
ClientSecret: Client Secret
adminUser: github帐号 #指定可初始化评论账户
distractionFreeMode: true

作者:xingguang
链接:原文链接:https://www.tiance.club/post/1180153653.html

原文地址:https://www.cnblogs.com/yizhidaozuihou/p/12445987.html