diff --git a/annotation-setting.yaml b/annotation-setting.yaml index 964dde0..76c355b 100644 --- a/annotation-setting.yaml +++ b/annotation-setting.yaml @@ -69,6 +69,18 @@ spec: label: 关闭 - value: "" label: 跟随默认配置 + - $formkit: radio + name: enable_donate + label: 开启文章打赏 + value: "" + help: '当前配置将覆盖主题中的默认配置。' + options: + - value: "true" + label: 开启 + - value: "false" + label: 关闭 + - value: "" + label: 跟随默认配置 --- @@ -122,4 +134,16 @@ spec: - value: "false" label: 关闭 - value: "" - label: 跟随默认配置 \ No newline at end of file + label: 跟随默认配置 + - $formkit: radio + name: enable_donate + label: 开启文章打赏 + value: "" + help: '当前配置将覆盖主题中的默认配置。' + options: + - value: "true" + label: 开启 + - value: "false" + label: 关闭 + - value: "" + label: 跟随默认配置 diff --git a/settings.yaml b/settings.yaml index b7fab8a..4b488f4 100644 --- a/settings.yaml +++ b/settings.yaml @@ -502,6 +502,16 @@ spec: label: 默认开启 - value: false label: 默认关闭 + - $formkit: radio + name: enable_post_donate + label: 开启文章打赏 + value: true + help: '如果文章或页面元数据配置了enable_donate项,则当前配置将被覆盖。' + options: + - value: true + label: 默认开启 + - value: false + label: 默认关闭 - $formkit: attachment name: donate_alipay label: 支付宝捐赠二维码 diff --git a/templates/main/admire.html b/templates/main/admire.html index bb78cad..b0120e5 100644 --- a/templates/main/admire.html +++ b/templates/main/admire.html @@ -1,5 +1,5 @@ + th:with="donate=${enableDonate && (!#strings.isEmpty(theme.config.post.donate_alipay) || !#strings.isEmpty(theme.config.post.donate_wechat))}">
如果觉得文章对你有用,请随意赞赏
-
\ No newline at end of file + diff --git a/templates/page.html b/templates/page.html index a830522..f820415 100644 --- a/templates/page.html +++ b/templates/page.html @@ -3,5 +3,6 @@ th:insert="~{common/layout :: layout (title = ${singlePage.spec.title + ' - ' + site.title}, canonical = ${singlePage.status.permalink}, content = ~{main/article :: article (${singlePage}, 'SinglePage')}, isPost = true)}" th:with="enableKatex = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_katex'))? singlePage.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex}, enableShare = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_share'))? singlePage.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share}, - enableCopyright = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_copyright'))? singlePage.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}"> - \ No newline at end of file + enableCopyright = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_copyright'))? singlePage.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}, + enableDonate = ${!#strings.isEmpty(singlePage.metadata.annotations.get('enable_donate'))? singlePage.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}"> + diff --git a/templates/post.html b/templates/post.html index 82b88f5..f72cafb 100644 --- a/templates/post.html +++ b/templates/post.html @@ -3,5 +3,6 @@ th:insert="~{common/layout :: layout (title = ${post.spec.title + ' - ' + site.title}, canonical = ${post.status.permalink}, content = ~{main/article :: article (${post}, 'Post')}, isPost = true)}" th:with="enableKatex = ${!#strings.isEmpty(post.metadata.annotations.get('enable_katex'))? post.metadata.annotations.get('enable_katex') : theme.config.post.enable_katex}, enableShare = ${!#strings.isEmpty(post.metadata.annotations.get('enable_share'))? post.metadata.annotations.get('enable_share') : theme.config.post.enable_post_share}, - enableCopyright = ${!#strings.isEmpty(post.metadata.annotations.get('enable_copyright'))? post.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}"> - \ No newline at end of file + enableCopyright = ${!#strings.isEmpty(post.metadata.annotations.get('enable_copyright'))? post.metadata.annotations.get('enable_copyright') : theme.config.post.enable_copyright}, + enableDonate = ${!#strings.isEmpty(post.metadata.annotations.get('enable_donate'))? post.metadata.annotations.get('enable_donate') : theme.config.post.enable_post_donate}"> +