Skip to content

Commit

Permalink
调整配置项 侧边栏最近文章-显示”置顶”标记 为 侧边栏最近文章-显示模式,根据选择对最新文章侧边栏进行排序
Browse files Browse the repository at this point in the history
  • Loading branch information
mjsoftking committed Nov 29, 2024
1 parent 9162bd7 commit 1a73673
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 侧边栏最近评论-展示评论数量
Expand Down
5 changes: 4 additions & 1 deletion templates/widget/recent_posts.html
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
# 许可
Expand Down

0 comments on commit 1a73673

Please sign in to comment.