Hexo Giscus 配置评论功能

注意:本文以 Fluid 主题为例介绍如何配置评论,其他主题请根据对应用户手册配置。

前言

Giscus 允许你将 GitHub Discussions 集成到你的网站上作为评论系统。这样做的好处是评论数据存储在 GitHub 上,不需要第三方服务。

官方地址https://giscus.app/


一、检查主题支持

首先检查你的 themes/fluid 下是否包含 giscus 相关的文件。如果 Fluid 版本过旧没有相关文件,需要先更新:

1
npm update --save hexo-theme-fluid

二、新建 GitHub 仓库

创建一个新的 GitHub 仓库,用于存放评论数据。

新建仓库


三、启用 Discussions 功能

进入仓库 Settings → General → Features,勾选 Discussions

启用 Discussions


四、安装 Giscus App

点击链接安装 Giscus:https://github.com/apps/giscus

安装 Giscus


五、获取配置信息

根据官网提示填写对应信息,获取 reporepo-idcategorycategory-id 等信息。

填写配置

完成后就能获取到所需的配置信息。

获取信息


六、修改 _config.fluid.yml

_config.fluid.yml 中添加或修改 giscus 配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
giscus:
repo: 你的用户名/仓库名
repo-id: 你的repo-id
category: Announcements
category-id: 你的category-id
# 评论映射方式:pathname | url | title | og:title
mapping: pathname
# 是否启用表情反应:0 | 1
reactions-enabled: 1
# 是否发送元数据:0 | 1
emit-metadata: 0
# 主题:light | dark | dark_high_contrast | transparent_dark | preferred_color_scheme
theme: preferred_color_scheme
# 语言:en | zh-CN
lang: zh-CN
# 评论框位置:top | bottom
input-position: top

同时确保评论功能开启:

1
2
3
comments:
enable: true
type: giscus

七、完成

打开自己的网站,看到评论框就大功告成了!

评论框


参考来源:https://giscus.app/


Hexo Giscus 配置评论功能
https://luoshuang.org/2026/04/05/Hexo-Giscus配置评论功能/
作者
LuoShuang
发布于
2026年4月5日
许可协议