Skip to content

Commit d78bb45

Browse files
committed
修复博客分类显示,确保在没有分类时显示“未分类”
1 parent f602de1 commit d78bb45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

templates/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ <h2 class="h2 article-title">最新文章</h2>
3939

4040
<div class="blog-content">
4141
<div class="blog-meta">
42-
<p class="blog-category" th:text="${post.categories[0].spec.displayName}"></p>
42+
<p class="blog-category"
43+
th:text="${#lists.isEmpty(post.categories) ? '未分类' : post.categories[0].spec.displayName}"></p>
4344
<span class="dot"></span>
4445
<time datetime="2022-02-23" th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"></time>
4546
</div>

0 commit comments

Comments
 (0)