Files
halo-theme-pix/templates/macro/home-blog.html
T

77 lines
5.5 KiB
HTML

<th:block th:fragment="home-blog(_posts,path,tag,selectedCategory)">
<div class="normal_list">
<div class="normal_list_inner" uk-height-viewport="offset-top: true">
<div class="posts_cat_nav">
<ul id="cat_nav_items">
<li><a th:data="${path}" th:classappend="${#strings.isEmpty(tag) ? 'active' : ''}">全部<span></span></a>
</li>
<li th:if="${theme.config.post.post_nav == 'category'}" th:each="categoryItem,iStat : ${categoryFinder.listAll()}">
<a th:if="${path == '/archives'}" th:data="@{/archives(tag=${categoryItem.spec.displayName})}"
th:classappend="${#strings.equals(tag, categoryItem.spec.displayName) or #strings.equals(selectedCategory, categoryItem.metadata.name) ? 'active' : ''}">[[${categoryItem.spec.displayName}]]<span></span></a>
<a th:unless="${path == '/archives'}" th:data="${categoryItem.status.permalink}"
th:classappend="${#strings.equals(tag, categoryItem.spec.displayName) or #strings.equals(selectedCategory, categoryItem.metadata.name) ? 'active' : ''}">[[${categoryItem.spec.displayName}]]<span></span></a>
</li>
<li th:if="${theme.config.post.post_nav == 'custom_category'}"
th:each="category : ${theme.config.post.nav_category}">
<th:block th:with="categoryItem = ${categoryFinder.getByName(category)}">
<a th:if="${categoryItem!=null and path == '/archives'}"
th:data="@{/archives(tag=${categoryItem.spec.displayName})}"
th:classappend="${#strings.equals(tag, categoryItem.spec.displayName) or #strings.equals(selectedCategory, categoryItem.metadata.name) ? 'active' : ''}">[[${categoryItem.spec.displayName}]]<span></span>
</a>
<a th:if="${categoryItem!=null and path != '/archives'}"
th:data="${categoryItem.status.permalink}"
th:classappend="${#strings.equals(tag, categoryItem.spec.displayName) or #strings.equals(selectedCategory, categoryItem.metadata.name) ? 'active' : ''}">[[${categoryItem.spec.displayName}]]<span></span>
</a>
</th:block>
</li>
</ul>
</div>
<div id="post_item" class="norpost_list " th:with='postItems=${_posts.items}'
th:classappend="${theme.config.post.post_list_type == 'grid' ? 'uk-grid-small uk-grid' : ''}">
<th:block th:replace="~{'macro/tpl/content-post'}"></th:block>
<th:block th:if="${#lists.isEmpty(postItems)}">
<th:block th:replace="~{macro/tpl/content-none}"/>
</th:block>
</div>
<th:block th:if="${_posts.totalPages>1}">
<div id="pagination">
<div class="post-paging"
th:with="_page = ${_posts.page+1},_path = ${path +'page/'+_page }">
<a th:if="${_posts.hasNext() and path == '/archives' and #strings.isEmpty(tag)}"
th:data="@{/archives(page=${_page})}" th:text="${theme.config.base_set.site_page}"></a>
<a th:if="${_posts.hasNext() and path == '/archives' and not #strings.isEmpty(tag)}"
th:data="@{/archives(tag=${tag},page=${_page})}" th:text="${theme.config.base_set.site_page}"></a>
<a th:if="${_posts.hasNext() and path != '/archives'}" th:data="${_path}"
th:text="${theme.config.base_set.site_page}"></a>
<form class="page-jump-form" method="get" th:action="@{${path}}">
<span class="page-jump-label">转到</span>
<input th:if="${not #strings.isEmpty(tag)}" type="hidden" name="tag" th:value="${tag}" />
<span class="page-jump-input-wrap">
<button class="page-jump-step page-jump-step-down" type="button"
title="减少页码" aria-label="减少页码"><i class="ri-subtract-line"
aria-hidden="true"></i></button>
<input class="page-jump-input" type="number" name="page" min="1"
th:max="${_posts.totalPages}" th:value="${_posts.page}"
inputmode="numeric" aria-label="页码" autocomplete="off" required />
<button class="page-jump-step page-jump-step-up" type="button"
title="增加页码" aria-label="增加页码"><i class="ri-add-line"
aria-hidden="true"></i></button>
</span>
<span class="page-jump-total">/ [[${_posts.totalPages}]]</span>
<button class="page-jump-submit" type="submit" title="跳转到指定页"
aria-label="跳转到指定页"><i class="ri-arrow-right-line"></i></button>
</form>
</div>
</div>
</th:block>
<div id="comment_form_reset">
</div>
</div>
</div>
</th:block>