新增分类 widgets 修改 th:href 添加 @{}

This commit is contained in:
liuzhihang 2022-10-29 14:17:10 +08:00
parent d22c9f0e62
commit 3de413608a
15 changed files with 54 additions and 34 deletions

View File

@ -20,7 +20,7 @@
th:classappend="${category.metadata.name == categoryItem.metadata.name} ? 'select'"
th:each="categoryItem : ${categoryFinder.listAll()}"
th:id="${categoryItem.spec.displayName}">
<a th:href="${categoryItem.status.permalink}"
<a th:href="@{${categoryItem.status.permalink}}"
th:text="${categoryItem.spec.displayName}"></a>
</div>
@ -34,7 +34,7 @@
<!-- TODO 按照年份分组 需要 halo 提供归档数据-->
<!--<div class="article-sort-item year">2022</div>-->
<div class="article-sort-item" th:each="post : ${posts.items}">
<a class="article-sort-item-img" th:href="${post.status.permalink}"
<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) ? theme.config.layout.post_random_img : post.spec.cover}">
@ -48,11 +48,11 @@
</time>
</div>
<a class="article-sort-item-title" onclick="window.event.cancelBubble=!0"
th:href="${post.status.permalink}" th:text="${post.spec.title}"
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}">
th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
<span class="tags-punctuation">#</span>
[[${tag.spec.displayName}]]
</a>

View File

@ -24,7 +24,7 @@
<th:block th:replace="modules/post-list :: post-list"></th:block>
</div>
<div th:replace="modules/aside :: aside('profile,wechat,recent-posts,tags-stat')"></div>
<div th:replace="modules/aside :: aside('profile,wechat,recent-posts,categories,tags-stat')"></div>
</main>
<!-- 底部 -->
<footer th:replace="modules/footer :: footer"></footer>

View File

@ -12,7 +12,7 @@
<div class="category-bar-item"
th:each="categoryItem : ${categories}"
th:id="${categoryItem.spec.displayName}">
<a th:href="${categoryItem.status.permalink}" th:text="${categoryItem.spec.displayName}"></a>
<a th:href="@{${categoryItem.status.permalink}}" th:text="${categoryItem.spec.displayName}"></a>
</div>
</th:block>

View File

@ -19,7 +19,7 @@
<h3 class="footer-title" th:text="${menuItem.status.displayName}"></h3>
<div class="footer-links">
<a class="footer-item" th:each="childMenu : ${menuItem.children}"
th:href="${childMenu.status.href}"
th:href="@{${childMenu.status.href}}"
th:text="${childMenu.status.displayName}">
</a>
</div>

View File

@ -11,7 +11,7 @@
th:each="post,iStat : ${postItems}">
<div class="post_cover cover_radius">
<a th:attr="title=${post.spec.title}" th:href="${post.status.permalink}">
<a th:attr="title=${post.spec.title}" th:href="@{${post.status.permalink}}">
<img class="post_bg entered loaded" loading="lazy"
th:alt="${post.status.excerpt}"
th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.post_random_img : post.spec.cover}">
@ -21,7 +21,7 @@
<th:block th:if="${not #lists.isEmpty(post.categories)}">
<a class="article-meta__categories"
th:each="category : ${post.categories}"
th:href="${category.status.permalink}"
th:href="@{${category.status.permalink}}"
th:text="${category.spec.displayName}"
th:title="${category.spec.displayName}">
</a>
@ -31,7 +31,7 @@
<span class="lastestpost">最新文章</span>
<a class="article-title"
th:attr="title=${post.spec.title}"
th:href="${post.status.permalink}"
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}">
</a>
<div class="content" th:text="${post.status.excerpt}"></div>
@ -45,7 +45,7 @@
<a class="article-meta__tags" event.cancelbubble
onclick="window.event.cancelBubble=!0"
th:each="tag : ${post.tags}"
th:href="${tag.status.permalink}"
th:href="@{${tag.status.permalink}}"
th:title="${tag.spec.displayName}">
<span class="tags-punctuation">#[[${tag.spec.displayName}]]</span>
</a>
@ -72,7 +72,7 @@
<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()}">
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
<i class="fas fa-chevron-left fa-fw"></i>
<div class="pagination_tips_prev">上页</div>
</a>
@ -85,7 +85,7 @@
</a>
<!-- 下一页 -->
<a class="extend next" rel="next" th:href="${posts.nextUrl}" th:if="${posts.hasNext()}">
<a class="extend next" rel="next" th:href="@{${posts.nextUrl}}" th:if="${posts.hasNext()}">
<div class="pagination_tips_next">下页</div>
<i class="fas fa-chevron-right fa-fw"></i>
</a>
@ -98,7 +98,7 @@
<div class="pagination" th:if="${totalPages gt 7}">
<!-- 上一页 -->
<a class="extend prev" rel="prev" th:href="${posts.prevUrl}" th:if="${posts.hasPrevious()}">
<a class="extend prev" rel="prev" th:href="@{${posts.prevUrl}}" th:if="${posts.hasPrevious()}">
<i class="fas fa-chevron-left fa-fw"></i>
<div class="pagination_tips_prev">上页</div>
</a>
@ -151,7 +151,7 @@
</a>
<!-- 下一页 -->
<a class="extend next" rel="next" th:href="${posts.nextUrl}" th:if="${posts.hasNext()}">
<a class="extend next" rel="next" th:href="@{${posts.nextUrl}}" th:if="${posts.hasNext()}">
<div class="pagination_tips_next">下页</div>
<i class="fas fa-chevron-right fa-fw"></i>
</a>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 目录 -->
<div class="card-widget card-categories" th:fragment="categories" th:with="categories = ${categoryFinder.listAll()}">
<div class="item-headline"><i class="fas fa-folder-open"></i><span>分类</span></div>
<div class="aside-list">
<ul class="card-category-list">
<li class="card-category-list-item" th:each="category : ${categories}">
<a class="card-category-list-link" th:href="@{${category.status.permalink}}">
<span class="card-category-list-name" th:title="${category.spec.displayName}" th:text="${category.spec.displayName}"></span>
<span class="card-category-list-count" th:text="${category.status.postCount}"></span>
</a>
</li>
</ul>
</div>
</div>
</html>

View File

@ -5,11 +5,11 @@
<div class="aside-list">
<!-- 最新文章,用户可以自定义展示数量 -->
<div class="aside-list-item" th:each="post : ${posts}">
<a class="thumbnail" th:href="${post.status.permalink}" th:title="${post.spec.title}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img loading="lazy" th:alt="${post.spec.title}" th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.post_random_img : post.spec.cover}">
</a>
<div class="content">
<a class="title" th:href="${post.status.permalink}" th:text="${post.spec.title}"
<a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}"
th:title="${post.spec.title}"></a>
<time th:attr="datetime=${#dates.format(post.spec.publishTime, 'yyyy-MM-dd HH:mm:ss')}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"

View File

@ -7,7 +7,7 @@
<div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div>
<div class="card-tag-cloud">
<a style="font-size:1em;color:#d3d3d3" th:each="tag : ${tags}"
th:href="${tag.status.permalink}"
th:href="@{${tag.status.permalink}}"
th:title="${tag.spec.displayName}">
<!-- 角标 -->
[[${tag.spec.displayName}]]<sup th:text="${tag.status.postCount}"></sup>

View File

@ -141,19 +141,19 @@
<div class="categoryGroup">
<div class="categoryItem" style="box-shadow:var(--heo-shadow-blue)">
<a class="categoryButton CB1 bikan"
th:href="${#strings.isEmpty(theme.config.top.bikan)? theme.config.top.bikan : 'javascript:void(0);'}">
th:href="@{${#strings.isEmpty(theme.config.top.bikan)? theme.config.top.bikan : 'javascript:void(0);'}}">
<span class="categoryButtonText">必看精选</span><i class="fas fa-dove"></i>
</a>
</div>
<div class="categoryItem" style="box-shadow:var(--heo-shadow-red)">
<a class="categoryButton remen"
th:href="${#strings.isEmpty(theme.config.top.remen)? theme.config.top.remen : 'javascript:void(0);'}">
th:href="@{${#strings.isEmpty(theme.config.top.remen)? theme.config.top.remen : 'javascript:void(0);'}}">
<span class="categoryButtonText">热门文章</span><i class="fas fa-burn"></i>
</a>
</div>
<div class="categoryItem" style="box-shadow:var(--heo-shadow-green)">
<a class="categoryButton shiyong"
th:href="${#strings.isEmpty(theme.config.top.shiyong)? theme.config.top.shiyong : 'javascript:void(0);'}">
th:href="@{${#strings.isEmpty(theme.config.top.shiyong)? theme.config.top.shiyong : 'javascript:void(0);'}}">
<span class="categoryButtonText">实用教程</span><i class="fas fa-book"></i>
</a>
</div>

View File

@ -26,7 +26,7 @@
<div class="card-tag-cloud" th:with="tags = ${tagFinder.listAll()}">
<a style="font-size:1em;color:#d3d3d3"
th:each="tag : ${tags}"
th:href="${tag.status.permalink}"
th:href="@{${tag.status.permalink}}"
th:text="${tag.spec.displayName}">
<sup th:text="${tag.status.postCount}"> </sup>
</a>

View File

@ -19,7 +19,7 @@
<div class="back-menu-list">
<th:block th:each="childMenu : ${menuItem.children}">
<a class="back-menu-item" rel="external nofollow"
target="_blank" th:href="${childMenu.status.href}">
target="_blank" th:href="@{${childMenu.status.href}}">
<!-- icon 预留 -->
<!--<img class="back-menu-item-icon" th:src="@{图片地址}">-->
<span class="back-menu-item-text" th:text="${childMenu.status.displayName}"></span>

View File

@ -9,7 +9,7 @@
<div class="menus_item" th:each="menuItem : ${menuFinder.getDefault().menuItems}">
<!-- javascript:void(0);" -->
<a class="site-page" rel="external nofollow" th:href="${menuItem.status.href}">
<a class="site-page" rel="external nofollow" th:href="@{${menuItem.status.href}}">
<span th:text="${menuItem.status.displayName}"></span>
<i class="fas fa-chevron-down expand"></i>
</a>
@ -19,7 +19,7 @@
<!-- 子菜单 -->
<ul class="menus_item_child">
<li th:each="childMenu : ${menuItem.children}">
<a class="site-page child" th:href="${childMenu.status.href}">
<a class="site-page child" th:href="@{${childMenu.status.href}}">
<!-- 这里应该有一个 icon 暂时还不支持 -->
<!--<i class="fa-fw fa-duotone fa-list-timeline"></i>-->
<span th:text="${menuItem.status.displayName}"></span>

View File

@ -5,7 +5,7 @@
<div class="topGroup" th:fragment="top-group" th:with="posts = ${postFinder.list(1,6)}">
<div class="recent-post-item" th:each="post : ${posts}">
<div class="post_cover">
<a th:href="${post.status.permalink}" th:title="${post.spec.title}">
<a th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<span class="recent-post-top-text"></span>
<img class="post_bg" loading="lazy"
th:alt="${post.spec.title}"
@ -14,7 +14,7 @@
</div>
<div class="recent-post-info">
<a class="article-title"
th:href="${post.status.permalink}"
th:href="@{${post.status.permalink}}"
th:text="${post.spec.title}"
th:title="${post.spec.title}">
</a>

View File

@ -20,7 +20,7 @@
th:each="category : ${post.categories}"
th:if="${not #lists.isEmpty(post.categories)}">
<a class="post-meta-categories"
th:href="${category.status.permalink}"
th:href="@{${category.status.permalink}}"
th:text="${category.spec.displayName}"
th:title="${category.spec.displayName}">
</a>
@ -29,7 +29,7 @@
<div class="post-meta__tag-list">
<a class="post-meta__tags"
th:each="tag : ${post.tags}"
th:href="${tag.status.permalink}"
th:href="@{${tag.status.permalink}}"
th:text="'#'+${tag.spec.displayName}"
th:title="${tag.spec.displayName}"></a>
</div>
@ -144,7 +144,7 @@
<div class="tag_share">
<div class="post-meta__tag-list">
<a class="post-meta__tags" th:each="tag : ${post.tags}"
th:href="${tag.status.permalink}">
th:href="@{${tag.status.permalink}}">
<span class="tags-punctuation">#</span>
<th:block th:text="${tag.spec.displayName}"
th:title="${tag.spec.displayName}"></th:block>

View File

@ -12,7 +12,7 @@
<div id="tag-page-tags" th:with="tags = ${tagFinder.listAll()}">
<a style="font-size:1em;color:#3c228c"
th:each="tag : ${tags}"
th:href="${tag.status.permalink}"
th:href="@{${tag.status.permalink}}"
th:id="${tag.spec.displayName}">
<span class="tags-punctuation">#</span> [[${tag.spec.displayName}]]
<span class="tagsPageCount" th:text="${tag.status.postCount}"></span>
@ -22,7 +22,7 @@
<div class="article-sort" th:with="postItems=${posts.items}">
<!--<div class="article-sort-item year">2022</div>-->
<div class="article-sort-item" th:each="post : ${postItems}">
<a class="article-sort-item-img" th:href="${post.status.permalink}"
<a class="article-sort-item-img" th:href="@{${post.status.permalink}}"
th:title="${post.spec.title}">
<img loading="lazy" th:alt="${post.status.excerpt}" th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.post_random_img : post.spec.cover}">
</a>
@ -33,12 +33,12 @@
</time>
</div>
<a class="article-sort-item-title" onclick="window.event.cancelBubble=!0"
th:href="${post.status.permalink}"
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" event.cancelbubble onclick="window.event.cancelBubble=!0"
th:each="tag : ${post.tags}" th:href="${tag.status.permalink}">
th:each="tag : ${post.tags}" th:href="@{${tag.status.permalink}}">
<span class="tags-punctuation">#[[${tag.spec.displayName}]]</span>
</a>
<span class="article-meta__link"></span>