Merge pull request #84 from shy-share/main

修复随机图片问题
This commit is contained in:
sunheyi 2023-02-09 13:33:14 +08:00 committed by GitHub
commit 41b67219c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,8 @@
<html lang="en" xmlns:th="http://www.thymeleaf.org"> <html lang="en" xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="post-list" <th:block th:fragment="post-list"
th:with="postItems=${posts.items}"> th:with='postItems=${posts.items},postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg : theme.config.layout.postRandomImg+"?"}'>
<!-- card需要添加在没有图片时使用随机图片 --> <!-- card需要添加在没有图片时使用随机图片 -->
<div class="recent-post-item" <div class="recent-post-item"
@ -16,8 +17,7 @@
<a th:attr="title=${post.spec.title}" th:href="@{${post.status.permalink}}"> <a th:attr="title=${post.spec.title}" th:href="@{${post.status.permalink}}">
<img class="post_bg entered loaded" loading="lazy" <img class="post_bg entered loaded" loading="lazy"
th:alt="${post.status.excerpt}" th:alt="${post.status.excerpt}"
th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}"> th:src='${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+iStat.index : post.spec.cover}'> </a>
</a>
</div> </div>
<!-- 类别非空时 --> <!-- 类别非空时 -->
<th:block th:if="${not #lists.isEmpty(post.categories)}"> <th:block th:if="${not #lists.isEmpty(post.categories)}">