add category-tree

This commit is contained in:
Qubot 2025-04-14 16:07:03 +00:00
parent 42de5a6d96
commit 0865e2de16
2 changed files with 37 additions and 0 deletions

26
templates/categories.html Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org" lang="zh-CN">
<th:block th:replace="~{modules/import}" />
<body>
<th:block th:replace="~{modules/header::goPage('home')}" />
<main>
<div class="main-content">
<li th:replace="~{modules/category-tree :: single(categories=${categories})}" />
</div>
</main>
<!-- ======= Footer ======= -->
<th:block th:replace="~{modules/footer}" />
<!-- End Footer -->
<script th:src="@{/assets/js/script.js?v={version}(version=${theme.spec.version})}"></script>
<script type="module"
src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/ionicons/5.5.2/ionicons/ionicons.esm.js"></script>
<script nomodule
src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/ionicons/5.5.2/ioniconshttps://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/ionicons/5.5.2/ionicons/ionicons.js"></script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<ul class="category-list" th:fragment="next (categories)">
<li class="category-item" th:fragment="single (categories)" th:each="category : ${categories}">
<a class="category-link" th:href="@{${category.status.permalink}}">
<span class="category-name" th:text="${category.spec.displayName}"> </span>
</a>
<th:block th:if="${not #lists.isEmpty(category.children)}">
<th:block th:replace="~{modules/category-tree :: next (categories=${category.children})}"></th:block>
</th:block>
</li>
</ul>