Hexo Fluid 配置 Giscus
[TOC]
使用Giscus在Hexo Fluid文章中评论功能。
giscus官网:https://giscus.app
准备工作
- 准备一个github的公开仓库
- 为该仓库安装
giscus App, 安装giscus App - 在该仓库中开启
Discussions功能,在你的仓库中启用
Giscus 的运作原理
giscus 加载时,会使用 GitHub Discussions 搜索 API 根据选定的映射方式(如 URL、pathname、<title> 等)来查找与当前页面关联的 discussion。如果找不到匹配的 discussion,giscus bot 就会在第一次有人留下评论或回应时自动创建一个 discussion。
访客如果想要评论,必须按照 GitHub OAuth 流程授权 giscus app 代表他发布,或者可以直接在 GitHub Discussion 里评论。你可以在 GitHub 上管理评论。
配置
接下来在 giscus 的官网 配置模块选择所需配置:
其中 Discussion 分类那里 giscus 推荐使用的 是 Announcements ,但是我没有弄好,索性就用 General 了,全部选好后,下边会出现一个你选的配置 <script> 标签。在 Fluid 的 _config.yml 文件中把对应位置 配置填上去即可。
1 | |
注意在 Fluid 开启评论插件1
2
3
4
5
6
7
8# 评论插件
# Comment plugin
comments:
enable: true
# 指定的插件,需要同时设置对应插件的必要参数
# The specified plugin needs to set the necessary parameters at the same time
# Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus | discuss
type: giscus