友链页面评论区支持新版插件配置同时保留旧版配置

This commit is contained in:
j m 2024-06-14 19:24:00 +08:00
parent 568fdd79aa
commit fb7064ec81
3 changed files with 45 additions and 14 deletions

View File

@ -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: 标签页面-开启标签颜色

View File

@ -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,6 +50,16 @@
<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}">
<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"
@ -58,13 +68,23 @@
with-replies="false"
></comment-widget>
</th:block>
</th:block>
<th:block th:unless="${theme.config.enhance.enable_pjax}">
<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>
</th:block>

View File

@ -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"
# 许可