简体中文
Appearance
自 v1.4.0 版本之后,本主题全面支持包括 Disqus、Waline、Artalk、Utterances、Giscus 和 Twikoo 在内的 6 款评论系统。
考虑到同时显示太多(超过 2 种)的评论系统对于用户来说没有什么意义,甚至还会有选择的负担,目前主题仅支持最多显示 2 种评论系统。为此,1.4.0 版本也重构了评论系统的代码和业务逻辑,包含以下原则:
site.comments
_config.yaml
comments
page.comments
post
page
Disqus > Waline > Artalk > Utterances > Giscus > Twikoo
以下为 _config.yaml 文件中的具体配置信息:
comments: disqus: true # 是否开启 Disqus 评论 disqus_url: 'https://h2o-ac.disqus.com/embed.js' # Disqus 链接 waline: true # 是否开启 Waline 评论 waline_url: 'https://h2o-ac-waline.deta.dev/' # Waline 链接 waline_reaction: true # 是否开启 Waline 表情反馈,以下为自定义本地化配置。 waline_locale: "{reaction0: '赞一个', reaction1: '踩一下', reaction2: '有点酷', reaction3: '看不懂', reaction4: '啥玩意', reaction5: '想睡觉'}" artalk: false # 是否开启 Artalk 评论 artalk_url: 'https://artalk.lisz.top' # Artalk 链接 artalk_name: 'h2o-ac' # Artalk 项目名称 artalk_uaBadge: false # 是否显示 UserAgent utterances: false # 是否开启 Utterances 评论 utterances_url: 'https://utteranc.es/client.js' # Utterances 链接 utterances_repo: 'zhonger/utterances-comments' # Github 项目 giscus: false # 是否开启 Giscus 评论 giscus_url: 'https://giscus.app/client.js' # Giscus 链接 giscus_repo: 'zhonger/giscus-comments' # Github 项目 giscus_repo_id: 'R_kgDONLt80A' # 项目 id,请使用 https://giscus.app 获得 giscus_category_id: 'DIC_kwDONLt80M4CkDnG' # 类别 id,请使用 https://giscus.app 获得 giscus_lang: 'zh-CN' # Giscus 本地化配置 twikoo: false # 是否开启 Twikoo 评论 twikoo_url: 'https://twikoo.lisz.top' # Twikoo 链接 # twikoo_region: 'ap-shanghai' # 云区域,当且仅当使用腾讯云函数部署时使用 twikoo_lang: 'zh-CN' # Twikoo 本地化配置
下图是同时启用 Disqus 和 Waline 评论系统时的效果:
Disqus
Waline
评论的全局配置启用仅适用于文章页,单独页面启用需要在元信息中添加如下配置:
comments: disqus: false waline: true artalk: true utterances: false giscus: true twikoo: false
如上配置即使 Giscus 也在页面中启用了,但是由于优先级的原因,该页面将只会显示 Waline 和 Artalk 评论。
Giscus
Artalk
小提示
评论系统在 comments 字段中配置的前后顺序并不会影响优先级,评论系统的优先级是固定的。
评论
自 v1.4.0 版本之后,本主题全面支持包括 Disqus、Waline、Artalk、Utterances、Giscus 和 Twikoo 在内的 6 款评论系统。
多评论控制逻辑
考虑到同时显示太多(超过 2 种)的评论系统对于用户来说没有什么意义,甚至还会有选择的负担,目前主题仅支持最多显示 2 种评论系统。为此,1.4.0 版本也重构了评论系统的代码和业务逻辑,包含以下原则:
site.comments
字段,即_config.yaml
文件中的comments
字段)和页面控制(page.comments
字段,即页面元信息中的comments
字段)。post
模板的页面)生效,不对单独页面(基于page
模板的页面)生效。comments
字段,文章页面将会以页面控制信息优先,单独页面将以页面控制信息为准,对应可见下表。Disqus > Waline > Artalk > Utterances > Giscus > Twikoo
。_config.yaml
文件中。全局配置
以下为
_config.yaml
文件中的具体配置信息:下图是同时启用
Disqus
和Waline
评论系统时的效果:页面配置
评论的全局配置启用仅适用于文章页,单独页面启用需要在元信息中添加如下配置:
如上配置即使
Giscus
也在页面中启用了,但是由于优先级的原因,该页面将只会显示Waline
和Artalk
评论。小提示
评论系统在
comments
字段中配置的前后顺序并不会影响优先级,评论系统的优先级是固定的。