fix: 分类、Tag、recent-posts的随机图片问题
This commit is contained in:
parent
8b493c0f9b
commit
50fccd6b94
|
@ -33,11 +33,12 @@
|
||||||
<div class="article-sort">
|
<div class="article-sort">
|
||||||
<!-- TODO 按照年份分组 需要 halo 提供归档数据-->
|
<!-- TODO 按照年份分组 需要 halo 提供归档数据-->
|
||||||
<!--<div class="article-sort-item year">2022</div>-->
|
<!--<div class="article-sort-item year">2022</div>-->
|
||||||
<div class="article-sort-item" th:each="post : ${posts.items}">
|
<div class="article-sort-item" th:each="post : ${posts.items}"
|
||||||
|
th:with='postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"," : theme.config.layout.postRandomImg+"?"}'>
|
||||||
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
|
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
|
||||||
th:title="${post.spec.title}">
|
th:title="${post.spec.title}">
|
||||||
<img th:alt="${post.spec.title}"
|
<img th:alt="${post.spec.title}"
|
||||||
th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}">
|
th:src="${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}">
|
||||||
</a>
|
</a>
|
||||||
<div class="article-sort-item-info">
|
<div class="article-sort-item-info">
|
||||||
<div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
|
<div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
|
||||||
|
@ -53,8 +54,7 @@
|
||||||
<div class="article-sort-item-tags">
|
<div class="article-sort-item-tags">
|
||||||
<a class="article-meta__tags"
|
<a class="article-meta__tags"
|
||||||
th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
|
th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
|
||||||
<span class="tags-punctuation">#</span>
|
<span class="tags-punctuation">#</span>[[${tag.spec.displayName}]]
|
||||||
[[${tag.spec.displayName}]]
|
|
||||||
</a>
|
</a>
|
||||||
<span class="article-meta__link">•</span>
|
<span class="article-meta__link">•</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||||
<div class="card-widget card-recent-post" th:fragment="recent-posts" th:with="posts = ${postFinder.list(1,theme.config.post.recentPost)}">
|
<div class="card-widget card-recent-post" th:fragment="recent-posts" th:with='posts = ${postFinder.list(1,theme.config.post.recentPost)},
|
||||||
|
postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"," : theme.config.layout.postRandomImg+"?"}'>
|
||||||
<div class="item-headline"><i class="iconfont icon-listol"></i><span>最近发布</span></div>
|
<div class="item-headline"><i class="iconfont icon-listol"></i><span>最近发布</span></div>
|
||||||
<div class="aside-list">
|
<div class="aside-list">
|
||||||
<!-- 最新文章,用户可以自定义展示数量 -->
|
<!-- 最新文章,用户可以自定义展示数量 -->
|
||||||
<div class="aside-list-item" th:each="post : ${posts}">
|
<div class="aside-list-item" th:each="post : ${posts}">
|
||||||
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
|
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
|
||||||
<img loading="lazy" th:alt="${post.spec.title}" th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}">
|
<img loading="lazy" th:alt="${post.spec.title}"
|
||||||
|
th:src="${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}">
|
||||||
</a>
|
</a>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}" th:title="${post.spec.title}"></a>
|
<a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}" th:title="${post.spec.title}"></a>
|
||||||
|
|
|
@ -22,10 +22,11 @@
|
||||||
<div class="article-sort-title" th:text="${tag.spec.displayName}"></div>
|
<div class="article-sort-title" th:text="${tag.spec.displayName}"></div>
|
||||||
<div class="article-sort" th:with="postItems=${posts.items}">
|
<div class="article-sort" th:with="postItems=${posts.items}">
|
||||||
<!--<div class="article-sort-item year">2022</div>-->
|
<!--<div class="article-sort-item year">2022</div>-->
|
||||||
<div class="article-sort-item" th:each="post : ${postItems}">
|
<div class="article-sort-item" th:each="post : ${postItems}"
|
||||||
|
th:with='postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"," : theme.config.layout.postRandomImg+"?"}'>
|
||||||
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
|
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
|
||||||
th:title="${post.spec.title}">
|
th:title="${post.spec.title}">
|
||||||
<img loading="lazy" th:alt="${post.status.excerpt}" th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}">
|
<img loading="lazy" th:alt="${post.status.excerpt}" th:src="${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}">
|
||||||
</a>
|
</a>
|
||||||
<div class="article-sort-item-info">
|
<div class="article-sort-item-info">
|
||||||
<div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
|
<div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
|
||||||
|
|
Loading…
Reference in New Issue