深浅色模式
Vivian 主题支持多种评论系统,目前可选:
在 .vitepress/config.mts 中配置 comment 字段:
.vitepress/config.mts
comment
export default defineConfig({ themeConfig: { comment: { provider: 'none', // 'none' | 'twikoo' | 'utterances' // ... 对应评论系统的配置 } } })
前往 Twikoo 官方文档 完成环境搭建。
comment: { provider: 'twikoo', twikoo: { enabled: true, envId: 'https://your-twikoo-url.vercel.app', // 可选配置 // region: 'ap-shanghai', // path: 'window.location.pathname', // lang: 'zh-CN', }, },
Utterances 是一个基于 GitHub Issues 的轻量级评论系统。
comment: { provider: 'utterances', utterances: { repo: 'owner/repo', // 必填: GitHub 仓库,格式: owner/repo issueTerm: 'pathname', // 用于匹配 issue 的字段: pathname | url | title | og:title label: 'comment', // 可选: issue 标签,用于筛选评论 issue theme: '', // 可选: 主题,留空则跟随站点深浅色自动切换 crossorigin: 'anonymous', // 可选: CORS 设置 }, },
repo
string
owner/repo
issueTerm
pathname
url
title
og:title
label
theme
crossorigin
anonymous
use-credentials
github-light
github-dark
preferred-color-scheme
github-dark-orange
icy-dark
dark-blue
photon-dark
boxy-light
gruvbox-dark
提示:如果 theme 留空,Utterances 会自动跟随站点的深浅色模式切换。
comment: { provider: 'utterances', utterances: { repo: 'my-username/my-blog', issueTerm: 'pathname', label: 'blog-comment', // theme: 'github-dark', // 留空则自动跟随深浅色 }, },
如果你之前使用的是旧版 twikoo 配置,可以迁移到新的 comment 配置:
twikoo
旧配置:
themeConfig: { twikoo: { enabled: true, envId: 'https://your-twikoo-url.vercel.app', } }
新配置:
themeConfig: { comment: { provider: 'twikoo', twikoo: { enabled: true, envId: 'https://your-twikoo-url.vercel.app', }, } }
注意:旧版 twikoo 配置仍然兼容,但推荐使用新的 comment 配置格式。
评论系统
前言
Vivian 主题支持多种评论系统,目前可选:
配置
在
.vitepress/config.mts中配置comment字段:2
3
4
5
6
7
8
Twikoo
环境搭建
前往 Twikoo 官方文档 完成环境搭建。
配置
2
3
4
5
6
7
8
9
10
11
Utterances
Utterances 是一个基于 GitHub Issues 的轻量级评论系统。
特点
前置条件
安装 Utterances App
配置
2
3
4
5
6
7
8
9
10
参数说明
repostringowner/repoissueTermstringpathnamepathname、url、title、og:title,或自定义字符串labelstringthemestringcrossoriginstringanonymousanonymous或use-credentials可用主题
github-lightgithub-darkpreferred-color-schemegithub-dark-orangeicy-darkdark-bluephoton-darkboxy-lightgruvbox-dark完整示例
2
3
4
5
6
7
8
9
工作原理
从旧版 Twikoo 配置迁移
如果你之前使用的是旧版
twikoo配置,可以迁移到新的comment配置:旧配置:
2
3
4
5
6
新配置:
2
3
4
5
6
7
8
9