53 lines
3.1 KiB
HTML
53 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
<!-- 阅读建议 -->
|
|
<th:block th:fragment="relatedPosts">
|
|
<div class="relatedPosts" th:if="${not #lists.isEmpty(post.categories)}">
|
|
<div class="headline">
|
|
<i class="iconfont icon-robot"></i>
|
|
<span>阅读建议</span>
|
|
</div>
|
|
<!-- 六篇文章 -->
|
|
<div th:if="${#strings.equals(theme.config.post.recommendQuantity, 'six')}" class="relatedPosts-list"
|
|
th:with="recommandPosts = ${postFinder.listByCategory(1, 7, post.categories.get(0).metadata.name)}">
|
|
<!-- 建议阅读,这里可以自定义文章数量,然后遍历展示 -->
|
|
<div th:each="recommandPost :${recommandPosts}"
|
|
th:if="${not #strings.equals(post.spec.title, recommandPost.spec.title)}">
|
|
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
|
|
<img alt="cover" class="cover" loading="lazy" id="preimg"
|
|
th:src="${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}">
|
|
<div class="content is-center">
|
|
<div class="date" style="color: white"><i class="far fa-calendar-alt fa-fw"></i>
|
|
[[${#dates.format(recommandPost.spec.publishTime,'yyyy-MM-dd')}]]
|
|
</div>
|
|
<div class="title" style="color: white" th:text="${recommandPost.spec.title}"></div>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<!-- 两篇文章 -->
|
|
<div th:if="${#strings.equals(theme.config.post.recommendQuantity, 'two')}" class="relatedPosts-list"
|
|
th:with="recommandPosts = ${postFinder.listByCategory(1, 3, post.categories.get(0).metadata.name)}">
|
|
<div th:each="recommandPost :${recommandPosts}"
|
|
th:if="${not #strings.equals(post.spec.title, recommandPost.spec.title)}">
|
|
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
|
|
<img class="cover" alt="cover"
|
|
th:src="${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}">
|
|
<div class="content is-center">
|
|
<div class="date"><i class="far fa-calendar-alt fa-fw"></i>
|
|
[[${#dates.format(recommandPost.spec.publishTime,'yyyy-MM-dd')}]]</div>
|
|
<div class="title" th:text="${recommandPost.spec.title}"></div>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<link th:if="${#strings.equals(theme.config.post.recommendQuantity, 'six')}" rel="stylesheet"
|
|
th:href="${assets_link + '/css/related-posts-six.css' + theme_version}">
|
|
<link th:if="${#strings.equals(theme.config.post.recommendQuantity, 'two')}" rel="stylesheet"
|
|
th:href="${assets_link + '/css/related-posts-two.css' + theme_version}">
|
|
</th:block>
|
|
|
|
|
|
</html> |