From 1a736730c7e4d45986e43e45ce1eacc5e41419ba Mon Sep 17 00:00:00 2001 From: mjsoftware <1406993111@qq.com> Date: Fri, 29 Nov 2024 13:06:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=20=E4=BE=A7=E8=BE=B9=E6=A0=8F=E6=9C=80=E8=BF=91=E6=96=87?= =?UTF-8?q?=E7=AB=A0-=E6=98=BE=E7=A4=BA=E2=80=9D=E7=BD=AE=E9=A1=B6?= =?UTF-8?q?=E2=80=9D=E6=A0=87=E8=AE=B0=20=E4=B8=BA=20=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E6=9C=80=E8=BF=91=E6=96=87=E7=AB=A0-=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A8=A1=E5=BC=8F=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=AF=B9=E6=9C=80=E6=96=B0=E6=96=87=E7=AB=A0=E4=BE=A7?= =?UTF-8?q?=E8=BE=B9=E6=A0=8F=E8=BF=9B=E8=A1=8C=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 8 ++++---- templates/widget/recent_posts.html | 5 ++++- theme.yaml | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/settings.yaml b/settings.yaml index f728ec9..3d8befa 100644 --- a/settings.yaml +++ b/settings.yaml @@ -919,14 +919,14 @@ spec: label: 不显示 - $formkit: radio name: recent_posts_pinned - label: 侧边栏最近文章-显示”置顶”标记 + label: 侧边栏最近文章-显示模式 value: false - help: '侧边栏最近文章是否显示”置顶”标记。' + help: '侧边栏最近文章显示模式,置顶优先:优先显示置顶文章,同时显示置顶标记,发布优先:优先显示最新发布的文章,不显示置顶标记。' options: - value: true - label: 显示 + label: 置顶优先 - value: false - label: 不显示 + label: 发布优先 - $formkit: number name: recent_comments_num label: 侧边栏最近评论-展示评论数量 diff --git a/templates/widget/recent_posts.html b/templates/widget/recent_posts.html index 12f9494..b16367e 100644 --- a/templates/widget/recent_posts.html +++ b/templates/widget/recent_posts.html @@ -1,7 +1,10 @@
+ th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)}, + sortCondition = ${theme.config.sidebar.recent_posts_pinned ? {'spec.pinned,desc', 'spec.publishTime,desc', 'metadata.creationTimestamp,desc'} : {'spec.publishTime,desc', 'metadata.creationTimestamp,desc'}}, + posts = ${postFinder.list({page: 1, size: num, sort: sortCondition})}, + isEmpty = ${#lists.isEmpty(posts)}">
更多 diff --git a/theme.yaml b/theme.yaml index 370315d..4de59d8 100644 --- a/theme.yaml +++ b/theme.yaml @@ -30,7 +30,7 @@ spec: settingName: theme-dream2-plus-setting configMapName: theme-dream2-plus-configMap # 版本号 - version: 1.3.2.beta1 + version: 1.3.2.beta2 # 最低支持的 Halo 版本 require: ">=2.20.0" # 许可