评论系统
评论系统
Vergil 支持接入第三方评论系统,目前可选 Giscus(基于 GitHub Discussions)和 Artalk(自托管)。
Giscus(推荐)
Giscus 是一个基于 GitHub Discussions 的评论系统,免费、无广告,适合技术博客。
前置条件
- 仓库需要是公开的
- 在仓库设置中开启 Discussions 功能
配置步骤
- 访问 giscus.app,按指引生成配置代码
- 在
src/data/site-config.ts中填写:
comments: {
giscus: {
repo: '你的用户名/你的仓库名',
repoId: '仓库ID',
category: 'Announcements',
categoryId: '分类ID',
mapping: 'pathname',
reactionsEnabled: '1',
theme: 'preferred_color_scheme'
}
}
- 保存后,文章详情页底部会自动显示评论框
读者使用
读者需要登录 GitHub 账号才能评论,评论内容会同步到你的仓库 Discussions 中。
Artalk
Artalk 是一个自托管的评论系统,数据完全由自己掌控。
配置步骤
- 部署 Artalk 服务端(参考 Artalk 文档)
- 在
src/data/site-config.ts中填写:
comments: {
artalk: {
server: 'https://your-artalk-server.com',
site: '你的网站名称'
}
}
开启评论
在文章信息头中设置 commentsEnabled: true:
---
title: 我的文章
commentsEnabled: true
---
或者在 site-config.ts 中全局开启:
comments: {
enabled: true,
// ... 具体配置
}