评论系统
页面底部的评论系统
Waline 评论系统#
主题的评论、阅读统计、点赞等功能均由 Waline ↗ 提供。
移除#
如果你有某些原因需要移除评论系统,或者只是想了解如何更换为其他评论系统,本部分可能对你有所帮助。但如果你只是想了解如何配置,可以跳过本部分。
按以下步骤移除:
- 在
src/site.config.ts中将enable设置为false。
src/site.config.ts
export const integ: IntegrationUserConfig = {
// ...
waline: {
enable: false
}
}ts- 移除依赖
@waline/client:
bun remove @waline/clientshell-
删除文件夹
src/components/waline。 -
移除以下布局中的相关代码:
src/layouts/CommonPage.astrosrc/layouts/BlogPost.astro
- 移除以下文件中为之前编辑的布局配置的相关配置,如
comment或view:
src/pages/about/index.astrosrc/pages/links/index.astrosrc/pages/projects/index.astro- 其他博客文章的 frontmatter 配置(如果存在)
部署#
你可以参考其文档进行配置,推荐使用 Vercel ↗ + Supabase ↗ 组合。
配置#
然后在 integrationConfig.server 中配置 Waline 评论系统。
src/site.config.ts
export const integ: IntegrationUserConfig = {
// ...
waline: {
enable: true,
// 服务端链接
server: 'https://astro-theme-pure-waline.arthals.ink/',
// 参考 https://waline.js.org/guide/features/emoji.html
emoji: ['bmoji', 'weibo'],
// 参考 https://waline.js.org/reference/client/props.html
additionalConfigs: {
pageview: true,
comment: true
// ...
}
}
}ts使用#
你可以在 .astro 或 .mdx 文件中手动调用。
import { Comment } from '@/components/waline'
// prettier-ignore
<Comment />jsx渲染效果: