修复“Gitalk未找到相关的Issues进行评论”的解决方法

读书是最有意思的旅行方式

2023-09-01 Viewed Times

问题描述

Hexo使用Gitalk,按照官方文档配置后出现以下问题:“未找到相关的 Issues 进行评论,请联系xxx初始化创建”

Gitalk issue

按照以下文档进行github OAuth的配置还是不可以:

打开github的settings —>developer settings—>OAuth application gitalk应用的设置。
Homepage URL设置为 username.github.io,精确到https的地址。
Authorization callback URL直接填写 注册的域名 就可以,注意也要精确到https。
update之后进行正常登录github即可评论。

解决方案

最后发现是github OAuth配置文件我填写错误,以下是配置文件的说明:

** 注:我网站有自己的域名,以自己的网站域名(web3.innovationroad.site)为例**

1
2
3
4
Application name:           # 授权应用的名称,这个是当前应用的名字,和你网站没关系,按照你的规则来填写
Homepage URL: # 填写博客所在的域名。比如填写: https://web3.innovationroad.site,注意,后面不要有/
Application description: # 可以不填写
Authorization callback URL: # 填写域名。比如:https://web3.innovationroad.site ;如果没有就填写仓库名即可.注意,后面不要有/

Hexo 中的配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
gitalk:
owner: "name_xxx" # 保存评论的仓库拥有者
admin: "name_xxx" # 保存评论的仓库管理员,其中管理员需要拥有初始化github issue 的权限,可以和owner相同
repo: "xxx_comment" # 保存评论的仓库名称,可以重新创建一个仓库用来专门存放评论
clientID: "xxxx" # 'GitHub Application Client ID'(上面配置github OAuth时会提供)
clientSecret: "xxxx" # 'GitHub Application Client Secret'(上面配置github OAuth时会提供)
perPage: 10 # Pagination size, with maximum 100.默认就好了
pagerDirection: last # Comment sorting direction, available values are last and first.默认
createIssueManually: false # By default, Gitalk will create a corresponding github issue for your every single page automatically when the logined user is belong to the admin users. You can create it manually by setting this option to true
language: zh-CN # Localization language key, en, zh-CN and zh-TW are currently available.
maxCommentHeight: 40 # An optional number to limit comments' max height, over which comments will be folded.Default 250. 建议少点,如果评论很多就不要用这个插件了
proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token # GitHub oauth request reverse proxy for CORS. For example, the demo url is 'https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token'.You should deploy your own proxy url as in this issue https://github.com/gitalk/gitalk/issues/429.默认

发布以后发现还是有问题

– 其实到这一步已经成功了,只是还没有初始化而已,用你创建评论仓库的github账户登录一下,然后在你的博客中点击“使用GITHUB登录”授权一下就可以了。


如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !