添加 categories 和 tags 页面,修复初始安装不能打开的问题

This commit is contained in:
liuzhihang 2022-11-22 00:05:55 +08:00
parent a422e4fee1
commit c245695249
6 changed files with 94 additions and 32 deletions

View File

@ -75,9 +75,7 @@ spec:
name: bannersIconPair
label: Banner 滚动图标
help: 为空时会使用系统内置图标
value:
- top:
bottom:
value: []
children:
- $formkit: group
name: top
@ -190,10 +188,7 @@ spec:
name: recommendPostCustom
label: 自定义文章
help: "建议设置六篇文章"
value:
- url:
title:
cover:
value: []
children:
- $formkit: url
name: url

35
templates/categories.html Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en" th:replace="modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category')"
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 hide-aside" id="content-inner">
<div id="page">
<h1 class="page-title" style="display: inline;">分类</h1>
<div class="category-lists">
<div class="category-title is-center">分类 - <span class="category-amount">11</span></div>
<div class="tag-cloud-list is-center">
<a style="font-size: 1em;"
th:each="categoryItem : ${categoryFinder.listAll()}"
th:href="@{${categoryItem.status.permalink}}"
th:id="${categoryItem.spec.displayName}">
<span class="tags-punctuation">#</span>
[[${categoryItem.spec.displayName}]]
<span class="tagsPageCount">[[${categoryItem.postCount}]]</span></a>
</div>
</div>
</div>
</main>
<!-- 底部 -->
<footer th:replace="modules/footer :: footer"></footer>
</div>
</th:block>
</html>

View File

@ -70,10 +70,9 @@
</div>
<nav id="pagination" th:if="${posts.hasPrevious() || posts.hasNext()}">
<nav id="pagination" th:if="${posts.hasPrevious() || posts.hasNext()}" th:with="totalPages = ${posts.totalPages}, pageIndex = ${posts.page}">
<!-- 页面小于 7 -->
<div class="pagination" th:if="${(posts.totalPages le 7) && (posts.totalPages gt 0)}">
<div class="pagination" th:if="${(totalPages le 7) && (totalPages gt 0)}">
<!-- 上一页 -->
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
@ -84,7 +83,7 @@
<!-- th:href="${PostFinder.list(index, posts.size)}" -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(1, posts.totalPages)}"
th:each="index : ${#numbers.sequence(1, totalPages)}"
th:text="${index}">
</a>
@ -99,7 +98,7 @@
<!-- 页面大于 7 -->
<!-- https://blog.csdn.net/lizc_lizc/article/details/80215147 -->
<div class="pagination" th:if="${posts.totalPages gt 7}">
<div class="pagination" th:if="${totalPages gt 7}">
<!-- 上一页 -->
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
@ -125,33 +124,33 @@
<!-- 最后一页与当前页面之差小于等于3 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${posts.totalPages - pageIndex le 3}">...</a>
<a class="page-number" th:if="${totalPages - pageIndex le 3}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(posts.totalPages - 4, posts.totalPages - 1)}"
th:if="${posts.totalPages - pageIndex le 3}"
th:each="index : ${#numbers.sequence(totalPages - 4, totalPages - 1)}"
th:if="${totalPages - pageIndex le 3}"
th:text="${index}">
</a>
<!-- 最后一页与当前页面之差大于3 且当前页面大于4 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}">...</a>
<a class="page-number" th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:each="index : ${#numbers.sequence(pageIndex - 1,pageIndex + 1)}"
th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}"
th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}"
th:text="${index}">
</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${(pageIndex gt 4) && (posts.totalPages - pageIndex gt 3)}">...</a>
<a class="page-number" th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}">...</a>
<!-- 尾页 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:text="${posts.totalPages}">
th:text="${totalPages}">
</a>
<!-- 下一页 -->
@ -159,7 +158,6 @@
<div class="pagination_tips_next">下页</div>
<i class="iconfont icon-chevron-right"></i>
</a>
</div>
</nav>

View File

@ -129,16 +129,18 @@
</div>
</div>
</div>
[[${#lists.size(theme.config.top.bannersIconPair)}]]
<div class="tags-group-wrapper"
th:if="${not #lists.isEmpty(theme.config.top.bannersIconPair)}"
th:with="iconPairs = ${theme.config.top.bannersIconPair}" >
<div class="tags-group-icon-pair" th:each="iconPair : ${iconPairs}">
<div class="tags-group-icon" th:style="'background:' + ${iconPair.top.background}">
<img th:src="@{${iconPair.top.url}}" th:title="${iconPair.top.name}">
</div>
<div class="tags-group-icon" th:style="'background:' + ${iconPair.bottom.background}">
<img th:src="@{${iconPair.bottom.url}}" th:title="${iconPair.bottom.name}">
</div>
[[${iconPair}]]
<!--<div class="tags-group-icon" th:style="'background:' + ${iconPair.top.background}">-->
<!-- <img th:src="@{${iconPair.top.url}}" th:title="${iconPair.top.name}">-->
<!--</div>-->
<!--<div class="tags-group-icon" th:style="'background:' + ${iconPair.bottom.background}">-->
<!-- <img th:src="@{${iconPair.bottom.url}}" th:title="${iconPair.bottom.name}">-->
<!--</div>-->
</div>
</div>
</div>

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 可以是最近六篇文章,也可以是自定义的文章 -->
<div class="topGroup" th:fragment="top-group">
<!-- 可以是最近六篇文章 -->
<div class="topGroup" th:fragment="top-group" th:with="topGroupPosts = ${postFinder.list(1,6)}">
<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)}">
th:each="post : ${topGroupPosts}"
th:if="${#strings.equals(theme.config.top.recommendPost, 'latest')}">
<div class="post_cover">
<a th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<span class="recent-post-top-text"></span>
@ -23,7 +23,7 @@
</a>
</div>
</div>
<!-- 自定义的文章右上角的推荐文章 -->
<div class="recent-post-item"
th:each="cuscomPost : ${theme.config.top.recommendPostCustom}"
th:if="${#strings.equals(theme.config.top.recommendPost, 'custom')}">

32
templates/tags.html Normal file
View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en" th:replace="modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'tag')"
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 hide-aside" id="content-inner">
<div id="page"><h1 class="page-title" style="display: inline;">标签</h1>
<div class="tag-cloud-title is-center">标签 - <span class="tag-cloud-amount">0</span></div>
<div class="tag-cloud-list is-center">
<a th:each="tagItem : ${tagFinder.listAll()}"
th:href="@{${tagItem.status.permalink}}"
th:id="${tagItem.spec.displayName}" th:style="'font-size: 1em; color:' + ${tagItem.spec.color} ">
<span class="tags-punctuation">#</span>
[[${tagItem.spec.displayName}]]
<span class="tagsPageCount">[[${tagItem.postCount}]]</span>
</a>
</div>
</div>
</main>
<!-- 底部 -->
<footer th:replace="modules/footer :: footer"></footer>
</div>
</th:block>
</html>