评论系统

作者:Goose 和 Quill
3 分钟阅读 257 字

目录

  1. 配置结构
  2. Giscus
  3. Waline
  4. 推荐的起点

Goosequill 目前通过 siteConfig.comments 支持两个评论提供商:

你应该一次只配置一个提供商。

配置结构

src/config.ts 中设置 comments

comments: {
provider: "giscus" | "waline",
}

Giscus

最小示例

comments: {
provider: "giscus",
repo: "owner/repo",
repoId: "R_kgDOExample",
category: "Announcements",
categoryId: "DIC_kwDOExample",
}

参数

参数类型必填默认值描述
provider"giscus"选择 Giscus
repostringGitHub 仓库,格式为 owner/name
repoIdstringGiscus 仓库 ID
categorystringGitHub Discussions 分类名称
categoryIdstringGitHub Discussions 分类 ID
mapping"pathname" | "url" | "title" | "og:title" | "specific" | "number""pathname"页面如何映射到讨论主题
strict"0" | "1""0"映射是否必须严格匹配
reactionsEnabled"0" | "1""1"在评论 UI 中启用反应
emitMetadata"0" | "1""0"将讨论元数据发射到页面
inputPosition"top" | "bottom""top"评论框位置
themestring仅回退浅色和深色共用的主题回退
theme_lightstring"light"浅色模式下使用的 Giscus 主题
theme_darkstring"dark"深色模式下使用的 Giscus 主题
langstring"en"Giscus UI 语言
loading"lazy" | "eager""lazy"脚本加载策略

说明

Waline

最小示例

comments: {
provider: "waline",
serverURL: "https://your-waline-server.example.com",
}

参数

参数类型必填默认值描述
provider"waline"选择 Waline
serverURLstringWaline 服务器端点
lang"zh" | "zh-CN" | "zh-TW" | "en" | "en-US" | "jp" | "jp-JP" | "pt-BR" | "ru" | "ru-RU" | "fr-FR" | "fr" | "vi" | "vi-vn" | "es" | "es-MX""en"Waline UI 语言
emojistring[] | falsefalse表情来源列表,或禁用表情
meta("nick" | "mail" | "link")[]["nick", "mail", "link"]表单中显示的输入字段
requiredMeta("nick" | "mail" | "link")[][]变为必填的字段
login"enable" | "disable" | "force""enable"登录模式
wordLimitnumber | [number, number]0文字长度限制
pageSizenumber10每页评论数
searchbooleanfalse在面板中启用管理搜索
reactionboolean | string[]false启用反应或提供自定义反应图片
pageviewbooleanfalse启用页面浏览量计数器
noCopyrightbooleanfalse隐藏 Waline 版权
noRssbooleanfalse禁用 RSS 条目输出

说明

推荐的起点

如果你想要最小的工作配置:


关系图谱

Loading graph...