使用giscus评论系统

安装 hexo-next-giscus 插件

https://github.com/giscus/giscus
在博客根目录下执行安装命令:npm install hexo-next-giscus --save

评论插件配置

可以通过这个网站,来选择生成相应的配置字段,前提需要在 GitHub 创建仓库,具体可参照博客:hexo-butterfly 主题-giscus 评论系统设置

img

然后可以将网站生成的对应字段填入配置文件:

img

为方便复制,给出可复制代码:

_config.yml
giscus:
enable: true
repo: RediYo/giscus # Github repository name
repo_id: R_kgDOKAvrvQ # Github repository id
category: Announcements # Github discussion category
category_id: DIC_kwDOKAvrvc4CYMJl # Github discussion category id
# Available values: pathname | url | title | og:title
mapping: pathname
# Available values: 0 | 1
reactions_enabled: 1
# Available values: 0 | 1
emit_metadata: 1
# Available values: light | dark | dark_high_contrast | transparent_dark | preferred-color-scheme
theme: preferred_color_scheme
# Place the comment box above the comments
input_position: top
# Available values: en | zh-CN
lang: zh-CN
# Available value: anonymous
crossorigin: anonymous