Post

jekyll开启评论

jekyll开启评论

文档

使用giscus为网站添加评论系统通用方法

步骤

创建公开仓库

  1. 创建公开文档
  2. 确保仓库开启了 Discussions
  3. 确保安装了 giscus app
  4. 获取giscus配置
    1. 语言
    2. 仓库
    3. 页面 ↔️ discussion 映射关系,推荐选择title
    4. Discussion 分类:推荐选择Announcements
    5. 开启懒加载特性
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<script src="https://giscus.app/client.js"
        data-repo="[在此输入仓库]"
        data-repo-id="[在此输入仓库 ID]"
        data-category="[在此输入分类名]"
        data-category-id="[在此输入分类 ID]"
        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>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
comments:
  # Global switch for the post comment system. Keeping it empty means disabled.
  # provider: # [disqus | utterances | giscus]
  provider: giscus
  # The provider options are as follows:
  disqus:
    shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
  # utterances settings › https://utteranc.es/
  utterances:
    # repo: # <gh-username>/<repo>
    repo: xiaogui2011/discusss
    issue_term: # < url | pathname | title | ...>
  # Giscus options › https://giscus.app
  giscus:
    repo: xiaogui2011/discuss
    repo_id: R_kgDOMplUsw
    category: General
    category_id: DIC_kwDOMplUs84CiApw
    mapping: title
    strict: # optional, default to '0'
    input_position: # optional, default to 'bottom'
    lang: # optional, default to the value of `site.lang`
    reactions_enabled: # optional, default to the value of `1`
This post is licensed under CC BY 4.0 by the author.