调整配置项 侧边栏最近文章-显示”置顶”标记 为 侧边栏最近文章-显示模式,根据选择对最新文章侧边栏进行排序

This commit is contained in:
mjsoftware 2024-11-29 13:06:46 +08:00
parent 9162bd725d
commit 1a736730c7
3 changed files with 9 additions and 6 deletions

View File

@ -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: 侧边栏最近评论-展示评论数量

View File

@ -1,7 +1,10 @@
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar)"
th:class="'card widget recent-posts ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.recent_posts_num)? 5 : T(java.lang.Integer).parseInt(theme.config.sidebar.recent_posts_num)}, posts = ${postFinder.list(1,num)}, isEmpty = ${#lists.isEmpty(posts)}">
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)}">
<div class="card-title">
<i th:class="${#strings.defaultString(sidebar.icon, 'ri-history-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '最新文章')}"></span>
<a th:if="${theme.config.sidebar.recent_posts_more}" class="card-more" th:href="@{/archives}">更多<i class="ri-arrow-right-double-line"></i></a>

View File

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