Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf:优化分类、标签、标签云下文章数量显示异常 #135

Merged
merged 4 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<li th:each="category : ${categories}">
<a class="level is-marginless" th:href="${category.status.permalink}">
<span class="level-item" th:text="${category.spec.displayName}"></span>
<span class="level-item tag" th:text="${category.status.postCount}"></span>
<span class="level-item tag" th:text="${category.status.postCount == null ? 0 : category.status.postCount}"></span>
</a>
<ul th:if="${!#lists.isEmpty(category.children)}">
<th:block th:replace="~{:: categories (${category.children})}"/>
</ul>
</li>
</th:block>
</th:block>
</th:block>
4 changes: 2 additions & 2 deletions templates/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<a th:each="tag : ${tags}" class="tags" th:href="${tag.status.permalink}">
<span class="tag" th:text="${tag.spec.displayName}"
th:style="${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +'; background: ' + tag.spec.color +'20' : ''}"></span>
<span class="tag is-grey" th:text="${tag.postCount}"
<span class="tag is-grey" th:text="${tag.postCount != null ? tag.postCount : 0}"
th:style="${(enableTagsColor && tag.spec.color != '#ffffff')? 'background: ' + tag.spec.color +'CC' : ''}"></span>
</a>
</div>
</div>
</th:block>
</th:block>
</th:block>
</th:block>
4 changes: 2 additions & 2 deletions templates/widget/categories.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar)"
th:class="'card widget ' + ${sidebar.hide}">
th:class="'card widget ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.categories_num)? 10 : T(java.lang.Integer).parseInt(theme.config.sidebar.categories_num)},
categories = ${categoryFinder.list(1,num)},
isEmpty = ${#lists.isEmpty(categories)}">
Expand All @@ -20,4 +20,4 @@
</li>
</ul>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions templates/widget/tagcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
th:each="tag : ${tags}"
th:href="@{${tag.status.permalink}}"
th:text="${tag.spec.displayName}"
th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + tag.postCount}"
th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + (tag.postCount != null ? tag.postCount : 0)}"
th:style="'font-size: ' + ${size < 14 ? 14 : size > 32 ? 32 : size} + 'px;' + ${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +';' : ''}"></a>
</div>
</div>
</div>