halo-theme-hao/templates/category.html

125 lines
7.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category',title = ${'分类' + ': ' + category.spec.displayName + ' | ' + site.title}, head = ~{::head})}">
<th:block th:fragment="head">
<th:block th:replace="~{modules/common/open-graph :: open-graph(_title = '分类',
_permalink = ${category.status.permalink},
_cover = ${category.spec.cover},
_excerpt = ${category.spec.description},
_type = 'website')}"></th:block>
</th:block>
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = ${'分类' + ': ' + category.spec.displayName})}"></nav>
</header>
<main class="layout" id="content-inner">
<div id="category">
<div id="category-bar">
<div class="category-bar-items" id="category-bar-items">
<div class="category-bar-item" id="category-bar-home">
<a href="/">首页</a>
</div>
<div class="category-bar-item"
th:classappend="${category.metadata.name == categoryItem.metadata.name} ? ' select'"
th:each="categoryItem : ${categoryFinder.listAll()}"
th:id="${categoryItem.spec.slug}">
<a th:href="@{${categoryItem.status.permalink}}"
th:text="${categoryItem.spec.displayName}"></a>
</div>
</div>
<!-- 跳转到分类页 -->
<a class="category-bar-more" href="/categories">更多</a>
</div>
<div class="recent-posts category_ui" id="recent-posts"
th:with='postItems=${posts.items},
postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"&" : theme.config.layout.postRandomImg+"?"}'>
<!-- card需要添加在没有图片时使用随机图片 -->
<div class="recent-post-item" th:classappend="${theme.config.layout.post.cols} + ' ' +
${theme.config.layout.post.postLocation} + ' ' +
(${iStat.even} ? 'even' : 'odd') + ' ' +
(${post.spec.pinned} ? 'pinned-post-item' : '')"
th:attr="onclick='pjax.loadUrl(\''+ @{${post.status.permalink}} +'\')'"
th:each="post,iStat : ${postItems}">
<div class="post_cover left_radius">
<a th:attr="title=${post.spec.title}" th:href="@{${post.status.permalink}}">
<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:data-lazy-src="${ isLazyload ? img : ''}"
th:src="${isLazyload ? loadingImg : img}">
</a>
</div>
<div class="recent-post-info">
<div class="recent-post-info-top">
<div class="recent-post-info-top-tips">
<!-- 类别非空时 -->
<th:block th:if="${not #lists.isEmpty(post.categories)}">
<span th:each="category : ${post.categories}"
th:href="@{${category.status.permalink}}"
th:text="${category.spec.displayName}"
th:title="${category.spec.displayName}" class="original"></span>
</th:block>
<!-- <span class="lastestpost">最新</span>-->
<a class="unvisited-post" th:href="@{${post.status.permalink}}"
th:title="${post.spec.title}" data-pjax-state="">未读</a>
</div>
<a class="article-title" th:attr="title=${post.spec.title}"
th:href="@{${post.status.permalink}}" th:text="${post.spec.title}">
</a>
<div class="content" th:text="${post.status.excerpt}"></div>
</div>
<div class="article-meta-wrap">
<!-- tag -->
<th:block th:if="${not #lists.isEmpty(post.tags)}">
<span class="article-meta tags">
<a class="article-meta__tags" event.cancelbubble
onclick="window.event.cancelBubble=!0" th:each="tag : ${post.tags}"
th:href="@{${tag.status.permalink}}" th:title="${tag.spec.displayName}">
<span
class="tags-punctuation">[[${#strings.trim(tag.spec.displayName)}]]</span>
</a>
</span>
</th:block>
<!-- 创建时间 -->
<span class="post-meta-date"
th:with="days=${(new java.util.Date().getTime()-post.spec.publishTime.toEpochMilli())/86400000}">
<i class="far fa-calendar-alt"></i>
<time style="display: inline;" th:datetime="${post.spec.publishTime}"
th:if="${days > 30}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
</time>
<time style="display: inline;" th:datetime="${post.spec.publishTime}"
th:if="${days <= 30 && days > 0}" th:text="${days}+天前"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
</time>
<time style="display: inline;" th:datetime="${post.spec.publishTime}"
th:if="${days == 0}" th:text="最近"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}+创建">
</time>
</span>
</div>
</div>
</div>
<!-- 分页 -->
<div
th:replace="~{modules/widgets/page :: page(${'/categories/'+category.spec.slug},${posts},false)}">
</div>
</div>
</div>
<!-- sidebar -->
<div th:replace="~{modules/aside :: aside(${theme.config.sidebar.widgetss.categoryWidgets})}"></div>
</main>
<!-- 底部 -->
<footer th:replace="~{modules/footer :: footer}"></footer>
</div>
</th:block>
</html>