Jekyll添加giscus评论系统
Jekyll添加giscus评论系统
准备仓库
- 可以选择博客所在的
username.github.io
仓库 - 也可以为评论系统单独创建一个仓库
添加 giscus
安装 giscus
选择仓库
开启 Discussion
路径:
Setings
-General
-Features
-Discussions
giscus 配置
语言:简体中文
仓库:
username/username-comments
页面 ↔️ discussion 映射关系: Discussion 的标题包含页面的
pathname
Discussion 分类:Announcements
一般选择 Announcements,因为 Announcements 类型的 discussion 只有管理员才有权限操作,这样便于管理
查看 giscus 配置
页面划到底部
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<script src="https://giscus.app/client.js" data-repo="username/username-comments" data-repo-id="R_sd000001" data-category="Announcements" data-category-id="DIC_sd000001dfdf" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme" data-lang="zh-CN" crossorigin="anonymous" async> </script>
配置到 Jekyll
配置主题:cotes2020/jekyll-theme-chirpy
1 2 3 4 5 6 7 8 9 10 11 12
comments: active: giscus # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable # The active options are as follows: giscus: repo: "username/username-comments" # <gh-username>/<repo> repo_id: "R_sd000001" category: "Announcements" category_id: "DIC_sd000001dfdf" mapping: "pathname" # optional, default to 'pathname' input_position: "bottom" # optional, default to 'bottom' lang: "zh-CN" # optional, default to the value of `site.lang` reactions_enabled: # optional, default to the value of `1`
效果展示
参考文档
本文由作者按照 CC BY 4.0 进行授权