21 lines
1.5 KiB
HTML
Raw Normal View History

2023-03-23 18:25:48 +08:00
<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)},
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)}">
2023-03-21 10:49:35 +08:00
<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>
2023-03-21 10:49:35 +08:00
</div>
2023-03-23 18:25:48 +08:00
<div th:if="${isEmpty}" class="card-empty">暂无文章</div>
<div th:unless="${isEmpty}" class="card-content">
<ul class="list">
<li class="item" th:each="post : ${posts}">
<a class="link" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}"><span class="top" th:if="${post.spec.pinned && theme.config.sidebar.recent_posts_pinned}">置顶</span>[[${post.spec.title}]]</a>
2023-09-12 10:44:43 +08:00
<i class="ri-link"></i>
2023-03-23 18:25:48 +08:00
</li>
</ul>
</div>
2023-03-21 10:49:35 +08:00
</div>