Skip to content

打赏

打赏配置管理打赏页面的展示内容,包括打赏方式和打赏者列表。

配置文件

src/config/sponsorConfig.ts

基础配置

属性类型默认值说明
titlestring""页面标题(留空使用 i18n 翻译)
descriptionstring""页面描述文本(留空使用 i18n 翻译)
usagestring-打赏用途说明
showSponsorsListbooleantrue是否显示打赏者列表
showCommentbooleantrue是否显示打赏页评论区(需先启用评论系统)
showButtonInPostbooleantrue是否在文章详情页底部显示打赏按钮

打赏方式

属性类型必填说明
namestring打赏方式名称
iconstring图标(Iconify 格式)
qrCodestring收款码图片路径(相对于 public 目录)
linkstring打赏链接 URL
descriptionstring描述文本
enabledboolean是否启用
ts
methods: [
  {
    name: "支付宝",
    icon: "fa7-brands:alipay",
    qrCode: "/assets/images/sponsor/alipay.png",
    link: "",
    description: "使用支付宝扫码打赏",
    enabled: true,
  },
  {
    name: "ko-fi",
    icon: "simple-icons:kofi",
    qrCode: "",
    link: "https://ko-fi.com/cuteleaf",
    description: "Buy a Coffee for Firefly",
    enabled: true,
  },
],

打赏者列表

属性类型必填说明
namestring打赏者名称
avatarstring打赏者头像 URL
amountstring打赏金额
datestring打赏日期(ISO 格式)
ts
sponsors: [
  {
    name: "夏叶",
    amount: "¥50",
    date: "2025-10-01",
  },
  {
    name: "匿名用户",
    amount: "¥20",
    date: "2025-10-01",
  },
],

TIP

需要在 siteConfig.ts 中将 pages.sponsor 设为 true 才能访问打赏页面。

打赏页评论区基于固定路径 /sponsor/,不需要创建 src/content/spec/sponsor.md 等内容文件。