halo-theme-dream2.0-plus
Version:
37 lines (36 loc) • 2.37 kB
HTML
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar, index)"
th:data-index="${index}"
th:data-position="${sidebar.position}"
th:class="'card widget tagcloud ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.tags_num)? 32 : T(java.lang.Integer).parseInt(theme.config.sidebar.tags_num)},
tags = ${tagFinder.list(1,num)},
isEmpty = ${#lists.isEmpty(tags.items)},
enableTagsColor = ${theme.config.sidebar.enable_tagcloud_color}">
<div class="card-title" th:with="defaultTitle=#{widget.tagcloud.title},
iconContent = ${#strings.defaultString(sidebar.icon_new?.value, 'ri-cloud-line')},
iconSvg = ${#strings.startsWith(iconContent, '<svg')}">
<i class="card-title-label"
th:unless="${iconSvg}"
th:classappend="${iconContent}"></i>
<th:block th:if="${iconSvg}" th:utext="${iconContent}"></th:block>
<span
th:text="${#strings.defaultString(sidebar.title, defaultTitle)}"></span>
<a th:if="${theme.config.sidebar.tagcloud_more}" class="card-more" th:href="@{${site.routes.tagsUri}}"
th:aria-label="#{global.more.name}" th:title="#{global.more.name}">[[#{global.more.name}]]<i
class="ri-arrow-right-double-line"></i></a>
</div>
<div th:if="${isEmpty}" class="card-empty">[[#{widget.tag.empty.tip}]]</div>
<th:block th:unless="${isEmpty}">
<div class="card-content tags-field">
<a th:each="tag : ${tags.items}" class="tags" th:href="${tag.status.permalink}"
th:aria-label="${tag.spec.displayName}" th:title="${tag.spec.displayName}">
<span class="tag" th:text="${tag.spec.displayName}"
th:style="${((enableTagsColor && tag.spec.color != '#ffffff')? ('color: ' + tag.spec.color +'; background: ' + tag.spec.color +'20') : '') + ';border-bottom-right-radius:0;border-top-right-radius:0;'}"></span>
<span class="tag is-grey" th:text="${tag.postCount == null ? 0 : tag.postCount}"
th:style="${(enableTagsColor && tag.spec.color != '#ffffff')? 'background: ' + tag.spec.color +'CC' : ''}"></span>
</a>
</div>
<script th:src="@{/assets/js/tagcloud.min.js(mew=${theme.spec.version})}"></script>
</th:block>
</div>