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

67 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 可以是最近六篇文章,也可以是自定义的文章 -->
<div class="topGroup" th:fragment="top-group">
<div class="recent-post-item"
th:each="post : ${posts}"
th:if="${#strings.equals(theme.config.top.recommendPost, 'latest')}"
th:with="posts = ${postFinder.list(1,6)}">
<div class="post_cover">
<a th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<span class="recent-post-top-text"></span>
<img class="post_bg" loading="lazy"
th:alt="${post.spec.title}"
th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}">
</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.recommendPostCustom}"
th:if="${#strings.equals(theme.config.top.recommendPost, 'custom')}">
<div class="post_cover">
<a th:href="@{${cuscomPost.url}}" th:title="${cuscomPost.title}">
<span class="recent-post-top-text"></span>
<img class="post_bg" loading="lazy"
th:alt="${cuscomPost.title}"
th:src="${cuscomPost.cover}">
</a>
</div>
<div class="recent-post-info">
<a class="article-title"
th:href="@{${cuscomPost.url}}"
th:text="${cuscomPost.title}"
th:title="${cuscomPost.title}">
</a>
</div>
</div>
<!-- 今日推荐 -->
<div class="todayCard" id="todayCard"
th:if="${theme.config.top.todayRecommendSwitch}"
th:onclick="'window.open('+ ${theme.config.top.todayRecommendContent.todayRecommendUrl} +')'">
<div class="todayCard-info">
<div class="todayCard-tips">今日推荐</div>
<div class="todayCard-title" th:text="${theme.config.top.todayRecommendContent.todayRecommendTitle}"></div>
</div>
<div class="todayCard-cover"
th:style="'background:url('+ ${theme.config.top.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="fas fa-circle-plus"></i>
<span class="banner-button-text">更多推荐</span>
</a>
</div>
</div>
</div>
</html>