halo-theme-hao/templates/modules/widgets/top-group.html

80 lines
3.8 KiB
HTML
Raw Normal View History

2024-04-12 06:35:37 +00:00
<!-- 推荐文章 -->
<div class="topGroup" th:with='topGroupPosts = ${postFinder.list(1,6)},
postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"&" : theme.config.layout.postRandomImg+"?"}'
>
<div class="recent-post-item"
th:each="post : ${topGroupPosts}"
th:if="${#strings.equals(theme.config.top.BannerRight.recommendPost, 'latest')}">
<div class="post_cover">
<a th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<span class="recent-post-top-text"
th:attr="onclick='pjax.loadUrl(\''+ @{${post.status.permalink}} +'\')'">荐</span>
<img class="post_bg"
th:with=' img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}'
th:alt="${post.spec.title}"
th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"
/>
</a>
</div>
<div class="recent-post-info">
<a class="article-title"
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}"
th:title="${post.spec.title}">
</a>
</div>
</div>
<!-- 自定义的文章右上角的推荐文章 -->
<div class="recent-post-item"
th:each="cuscomPost : ${theme.config.top.BannerRight.recommendPostCustom}"
th:if="${#strings.equals(theme.config.top.BannerRight.recommendPost, 'custom') && not #strings.isEmpty(cuscomPost.post) }">
<th:block th:with="post = ${postFinder.getByName(cuscomPost.post)}">
<div class="post_cover">
<a th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<span class="recent-post-top-text"
th:attr="onclick='pjax.loadUrl(\''+ @{${post.status.permalink}} +'\')'">荐</span>
<img class="post_bg"
th:with='img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}'
th:alt="${post.spec.title}"
th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"
/>
</a>
</div>
<div class="recent-post-info">
<a class="article-title"
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}"
th:title="${post.spec.title}">
</a>
</div>
</th:block>
</div>
<!-- 今日推荐 -->
<div class="todayCard" id="todayCard"
th:if="${theme.config.top.BannerRight.todayRecommend}"
th:attr="onclick='javascript:window.open(\''+ ${theme.config.top.BannerRight.todayRecommendContent.todayRecommendUrl} +'\')'">
<div class="todayCard-info">
<div class="todayCard-tips" th:text="${theme.config.top.BannerRight.todayRecommendContent.todayRecommendxTitle}"></div>
<div class="todayCard-title" th:text="${theme.config.top.BannerRight.todayRecommendContent.todayRecommendTitle}"></div>
</div>
<div class="todayCard-cover"
th:style="'background:url('+ ${theme.config.top.BannerRight.todayRecommendContent.todayRecommendCover} +') no-repeat center/cover'">
</div>
<div class="banner-button-group">
<a class="banner-button" onclick="window.event.cancelBubble=!0;heo.hideTodayCard()">
<i class="haofont hao-icon-circle-plus"></i>
<span class="banner-button-text">更多推荐</span>
</a>
</div>
</div>
</div>