本文最后更新于 306 天前 ,文中信息可能已经过时。如有问题请在评论区留言。

前言

之前有用过utterance来作为评论,需要自己添加comment.html文件。

后来是主题更换为PaperMod-PE,大佬集成了很多功能,而且默认集成giscus评论,于是就拿来直接用。

使用

评论区标题 & 副标题

yaml
params:
   # 启用评论
   comments: false
   # 评论区标题 
   discussionTitle: 欢迎来到评论区
   # 评论区子标题
   discussionSubtitle: 感谢您的耐心阅读!来选个表情,或者留个评论吧!

Giscus 配置

yaml
params:
   # giscus 评论参数
   giscus:
      repo: "<your repository>"
      repoId: "<your repo id>"
      category: "Announcements"
      categoryId: "<your category id>"
      mapping: "pathname"
      strict: "0"
      reactionsEnabled: "1"
      emitMetadata: "0"
      inputPosition: "top"
      lightTheme: "light"
      darkTheme: "dark"
      lang: "zh-CN"

问题及解决

配置明明没问题,但是就是不显示评论区

经过各种重启,更换其它仓库都无法显示。在搜文章时,看到需要添加comment.html文件。这才突然想起来,应该是自己添加的文件(先前使用utterance)影响到了giscus,因为现在的主题不需要自己来新增评论区文件的。删除后果然评论区正常。😂

参考博客: PaperMod-PE Documents