feat: 新增归档页template

This commit is contained in:
Airbo ZH 2023-02-10 12:26:25 +08:00
parent 9f2a4716a8
commit 8202cf3e48
1 changed files with 66 additions and 0 deletions

66
templates/archives.html Normal file
View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en" th:replace="modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'archive')"
xmlns:th="http://www.thymeleaf.org">
<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"></nav>
</header>
<main class="layout" id="content-inner">
<!-- archive -->
<div id="archive">
<div class="article-sort-title">文章 - [[${siteStatsFinder.getStats().post}]]</div>
<div class="article-sort" th:each="archive : ${archives.items}"
th:with='postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"," : theme.config.layout.postRandomImg+"?"}'>
<div class="article-sort-item year" th:text="${archive.year}"></div>
<div class="article-sort" th:each="month : ${archive.months}">
<!-- 月份没有样式所以不显示 -->
<!-- <div class="article-sort-item" th:text="${month.month}"></div> -->
<div class="article-sort-item" th:each="post : ${month.posts}">
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
th:title="${post.spec.title}">
<img th:alt="${post.spec.title}"
th:src="${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}">
</a>
<div class="article-sort-item-info">
<div class="article-sort-item-time"><i class="far fa-calendar-alt"></i>
<time class="post-meta-date-created"
th:attr="datetime=${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
th:title="'创建于' + ${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}">
</time>
</div>
<a class="article-sort-item-title" onclick="window.event.cancelBubble=!0"
th:href="@{${post.status.permalink}}" th:text="${post.spec.title}"
th:title="${post.spec.title}"></a>
<div class="article-sort-item-tags">
<a class="article-meta__tags"
th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
<span class="tags-punctuation">#</span>[[${tag.spec.displayName}]]
</a>
<span class="article-meta__link"></span>
</div>
</div>
</div>
</div>
</div>
<!-- //TODO 分页 -->
<nav id="pagination">
<div class="pagination">
<span class="page-number current" th:if="${archives.page} == ${index}"
th:text="${archives.page}"></span>
</div>
</nav>
</div>
<!-- sidebar -->
<div th:replace="modules/aside :: aside(${theme.config.sidebar.categoryWidgets})"></div>
</main>
<!-- 底部 -->
<footer th:replace="modules/footer :: footer"></footer>
</div>
</th:block>
</html>