From fb7064ec81c9cc19819a201d031c1d53ac8e2d8d Mon Sep 17 00:00:00 2001 From: j m <1406993111@qq.com> Date: Fri, 14 Jun 2024 19:24:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8B=E9=93=BE=E9=A1=B5=E9=9D=A2=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=8C=BA=E6=94=AF=E6=8C=81=E6=96=B0=E7=89=88=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE=E5=90=8C=E6=97=B6=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=97=A7=E7=89=88=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 11 +++++++++++ templates/links.html | 46 +++++++++++++++++++++++++++++++------------- theme.yaml | 2 +- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/settings.yaml b/settings.yaml index a298999..8dd55ce 100644 --- a/settings.yaml +++ b/settings.yaml @@ -1027,13 +1027,24 @@ spec: help: '友链页面最低部的补充说明信息,支持 HTML 格式。' - $formkit: radio name: link_enable_comment + id: link_enable_comment label: 友链页面-开启评论区 + help: '当链接插件版本>=1.4.0时,将内置评论区ID。为保留历史评论数据,可选择“开启并自定义评论区ID”选项。' value: true options: - value: true label: 开启 + - value: custom + label: 开启并自定义评论区ID - value: false label: 关闭 + - $formkit: singlePageSelect + name: link_comment_id + if: $get(link_enable_comment).value == 'custom' + label: 友链页面-评论区ID + validation: required + placeholder: '请选择一个页面作为友链页面的评论区ID' + help: '指定一个“自定义页面”用于友链页面的评论区ID,被指定的页面评论区将作为友链的评论区。' - $formkit: radio name: enable_tags_tag_color label: 标签页面-开启标签颜色 diff --git a/templates/links.html b/templates/links.html index ef9a08c..8be17cb 100644 --- a/templates/links.html +++ b/templates/links.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <th:block xmlns:th="https://www.thymeleaf.org" th:insert="~{common/layout :: layout (title = ${#strings.defaultString(linksTitle, '友链')} + ' - ' + ${site.title}, canonical = @{/links}, content = ~{::content}, isPost = false)}" - th:with="baseEnableComment = ${theme.config.page_config.link_enable_comment}"> + th:with="baseEnableComment = ${theme.config.page_config.link_enable_comment == true || (!#strings.isEmpty(theme.config.page_config.link_comment_id) && theme.config.page_config.link_enable_comment == 'custom')}"> <th:block th:fragment="content" th:with="defaultAvatar = ${#strings.defaultString(theme.config.page_config.links_default_avatar, #theme.assets('/img/avatar.svg'))}"> <div class="card"> @@ -50,20 +50,40 @@ <div class="card card-content comment-wrapper-z-index" id="comment-wrapper" th:if="${enableComment}"> <h3 class="comment-title">评论</h3> <th:block th:if="${theme.config.enhance.enable_pjax}"> - <comment-widget - group="plugin.halo.run" - kind="Plugin" - version="v1alpha1" - th:name="${pluginName}" - with-replies="false" - ></comment-widget> + <th:block th:if="${theme.config.page_config.link_enable_comment == 'custom'}"> + <comment-widget + group="content.halo.run" + kind="SinglePage" + version="v1alpha1" + th:name="${theme.config.page_config.link_comment_id}" + with-replies="false" + ></comment-widget> + </th:block> + <th:block th:if="${theme.config.page_config.link_enable_comment != 'custom'}"> + <comment-widget + group="plugin.halo.run" + kind="Plugin" + version="v1alpha1" + th:name="${pluginName}" + with-replies="false" + ></comment-widget> + </th:block> </th:block> <th:block th:unless="${theme.config.enhance.enable_pjax}"> - <halo:comment - group="plugin.halo.run" - kind="Plugin" - th:attr="name=${pluginName}" - /> + <th:block th:if="${theme.config.page_config.link_enable_comment == 'custom'}"> + <halo:comment + group="content.halo.run" + kind="SinglePage" + th:attr="name=${theme.config.page_config.link_comment_id}" + /> + </th:block> + <th:block th:if="${theme.config.page_config.link_enable_comment != 'custom'}"> + <halo:comment + group="plugin.halo.run" + kind="Plugin" + th:attr="name=${pluginName}" + /> + </th:block> </th:block> </div> </th:block> diff --git a/theme.yaml b/theme.yaml index 0479e45..cf2f51b 100644 --- a/theme.yaml +++ b/theme.yaml @@ -30,7 +30,7 @@ spec: settingName: theme-dream2-plus-setting configMapName: theme-dream2-plus-configMap # 版本号 - version: 0.0.0.15 + version: 0.0.0.17 # 最低支持的 Halo 版本 require: ">=2.15.0" # 许可