halo-theme-dream2.0-plus
Version:
106 lines (96 loc) • 6.25 kB
HTML
<th:block xmlns:th="https://www.thymeleaf.org"
th:fragment="article (post, type)"
th:with="updateInterval = ${T(java.lang.Math).floor((#dates.createNow().getTime()/1000.0 - post.status.lastModifyTime.getEpochSecond())/86400.0).intValue()},
isPost = ${type == 'Post'},
thumbnail_img = ${#strings.isEmpty(post.spec.cover) ? #strings.isEmpty(theme.config.post.default_thumbnail) ? '' : theme.config.post.default_thumbnail + (#strings.contains(theme.config.post.default_thumbnail, '?') ? '&' : '?') + 'id=' + post.metadata.name : post.spec.cover}">
<div th:if="${!#strings.isEmpty(thumbnail_img)}" class="card widget">
<div class="cover-image">
<img class="cover-image" th:alt="${post.spec.title}"
th:srcset="|${thumbnail.gen(thumbnail_img, 's')} 400w,
${thumbnail.gen(thumbnail_img, 'm')} 800w,
${thumbnail.gen(thumbnail_img, 'l')} 1200w,
${thumbnail.gen(thumbnail_img, 'xl')} 1600w|"
sizes="(max-width: 400px) 400px, (max-width: 800px) 800px, (max-width: 1200px) 1200px, (max-width: 1600px) 1600px"
th:src="${thumbnail_img}"/>
<div th:if="${isPost && !#lists.isEmpty(post.categories)}" class="category">
<a th:each="cy : ${post.categories}" th:href="${cy.status.permalink}"
th:aria-label="${cy.spec.displayName}" th:title="${cy.spec.displayName}"
th:text="${cy.spec.displayName}"></a>
</div>
<div class="details">
<h1 class="title" th:text="${post.spec.title}"></h1>
<div class="meta">
<th:block th:replace="~{main/breadcrumb :: breadcrumbList (post = ${post}, breadcrumbs = ${theme.config.post.breadcrumb_detail_list}, isPost = ${isPost})}"/>
</div>
</div>
</div>
</div>
<div th:if="${!#strings.isEmpty(theme.config.post.invalid_tips_day) && updateInterval > T(java.lang.Long).parseLong(theme.config.post.invalid_tips_day)}"
class="card tips brightness"><i class="ri-close-line click-close" data-close=".tips"></i>[[${#messages.msg('main.article.post_expire_prompt', #dates.format(post.status.lastModifyTime,theme.config.basic_info.global_time_format), updateInterval)}]]
</div>
<div th:if="${!#strings.isEmpty(post.metadata.annotations.get('tips'))}" class="card tips brightness"><i
class="ri-close-line click-close" data-close=".tips"></i>[[${post.metadata.annotations.tips}]]
</div>
<div th:if="${!#strings.isEmpty(thumbnail_img)}" class="card summary summary-thumbnail"></div>
<div class="card">
<div class="card-content main">
<th:block th:if="${#strings.isEmpty(thumbnail_img)}">
<h1 class="title" th:text="${post.spec.title}"></h1>
<div class="meta">
<th:block th:replace="~{main/breadcrumb :: breadcrumbList (post = ${post}, breadcrumbs = ${theme.config.post.breadcrumb_detail_list}, isPost = ${isPost})}"/>
<div th:if="${isPost && !#lists.isEmpty(post.categories)}" class="level-item">
<a th:each="cy : ${post.categories}" th:href="${cy.status.permalink}"
th:aria-label="${cy.spec.displayName}" th:title="${cy.spec.displayName}"
th:text="${cy.spec.displayName}"></a>
</div>
</div>
<hr/>
<div class="card summary summary-not-thumbnail"></div>
</th:block>
<div th:data-id="${post.metadata.name}" th:data-target="${type}" class="main-content article"
th:utext="${post.content.content}">
</div>
<th:block th:replace="~{main/admire}"/>
<div th:if="${isPost && !#lists.isEmpty(post.tags)}" class="article-operation">
<div class="level-item">
<a th:each=" tag : ${post.tags}" th:href="${tag.status.permalink}"
th:aria-label="${tag.spec.displayName}" th:title="${tag.spec.displayName}"
th:text="${tag.spec.displayName}"></a>
</div>
</div>
<th:block th:if="${enableCopyright || enableShare}">
<hr/>
<th:block th:if="${enableCopyright}">
<th:block th:replace="~{main/copyright}"/>
</th:block>
<div th:if="${enableShare}" class="dshare"></div>
</th:block>
</div>
</div>
<th:block th:if="${isPost}" th:with="postCursor = ${postFinder.cursor(post.metadata.name)},
prevPost = ${theme.config.post.cursor ? postCursor.next : postCursor.previous},
nextPost = ${theme.config.post.cursor ? postCursor.previous : postCursor.next},
hasPrev = ${theme.config.post.cursor ? postCursor.hasNext() : postCursor.hasPrevious()},
hasNext = ${theme.config.post.cursor ? postCursor.hasPrevious() : postCursor.hasNext()}">
<div th:if="${hasPrev || hasNext}" class="card">
<div class="level post-navigation card-content">
<a th:if="${hasPrev}" class="level-item"
th:href="@{${prevPost.status.permalink}}" th:aria-label="${prevPost.spec.title}" th:title="${prevPost.spec.title}">
<i class="ri-arrow-left-s-line"></i><span th:text="${prevPost.spec.title}"></span>
</a>
<a th:if="${hasNext}" class="level-item"
th:href="@{${nextPost.status.permalink}}" th:aria-label="${nextPost.spec.title}" th:title="${nextPost.spec.title}">
<span th:text="${nextPost.spec.title}"></span><i class="ri-arrow-right-s-line"></i>
</a>
</div>
</div>
</th:block>
<div class="card card-content comment-wrapper-z-index" id="comment-wrapper" th:if="${enableComment}">
<h3 class="comment-title">[[#{global.comment_title}]]</h3>
<halo:comment
group="content.halo.run"
th:kind="${type}"
th:attr="name=${post.metadata.name}"
/>
</div>
</th:block>