评论系统
页面底部的评论系统
Waline 评论系统#
本主题的评论、阅读统计、点赞等功能均由 Waline ↗ 提供。
移除#
如果你因某些原因需要移除评论系统,或者想了解如何更换为其他评论系统,本节可能会对你有帮助。但如果你想了解如何配置它,可以跳过本节。
通过以下步骤移除它:
-
在
src/site.config.ts
中将enable
设置为false
。src/site.config.ts
tsexport const integ: IntegrationUserConfig = { // ... waline: { enable: false } }
-
移除依赖
@waline/client
:
shellbun remove @waline/client
-
移除文件夹
src/components/waline
。 -
移除这些布局中的相关代码:
src/layouts/CommonPage.astro
src/layouts/BlogPost.astro
-
在这些文件中,移除为之前编辑的布局配置的
comment
或view
等相关配置:src/pages/about/index.astro
src/pages/links/index.astro
src/pages/projects/index.astro
- 其他存在的博客文章前置配置(如果有)
部署#
你可以参考其文档进行配置,建议使用 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/en/guide/features/emoji.html
emoji: ['bmoji', 'weibo'],
// 参考 https://waline.js.org/en/reference/client/props.html
additionalConfigs: {
pageview: true,
comment: true
// ...
}
}
}
ts使用#
你可以在 .astro
或 .mdx
文件中手动调用它。
import { Comment } from '@/components/waline'
// prettier-ignore
<Comment />
jsx渲染效果:
评论似乎卡住了。试试刷新页面?✨