halo-theme-dream2.0-plus
Version:
86 lines (76 loc) • 5.04 kB
HTML
<th:block
th:insert="~{common/layout :: layout (showTitle = ${#messages.msg('page.author.browser.title', (#annotations.getOrDefault(author, 'privacy_user', 'no') == 'yes' && author.metadata.name != #authentication.name) ? #messages.msg('page.author.browser.title.privacy_user') : author.spec.displayName, site.title)}, canonical = @{/authors}, content = ~{::content}, isPost = false, hideSidebar = false)}"
xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="content" th:with="isEmpty = ${#lists.isEmpty(posts.items)},
privacyUser = ${#annotations.getOrDefault(author, 'privacy_user', 'no') == 'yes' && author.metadata.name != logonUserName},
userName = ${privacyUser ? #messages.msg('page.author.browser.title.privacy_user') : author.spec.displayName}">
<div class="author">
<div class="card card-content author-info">
<div class="author-info-section">
<figure class="image" th:with="userAvatar = ${(#strings.isEmpty(author.spec.avatar) || privacyUser) ? #theme.assets('/img/avatar.svg') : author.spec.avatar}">
<img th:src="${userAvatar}" height="100%" width="100%"
th:alt="${userName}"
class="avatar">
</figure>
<div class="basic-info">
<h1 class="display-name" th:text="${userName}"></h1>
</div>
</div>
<div class="author-info-bio-section" th:if="${privacyUser}">
<div class="bio-content privacy">
<p class="privacy-user" th:text="#{'page.author.bio.privacy_user.tip'}"></p>
</div>
</div>
<!-- 描述区域 -->
<div class="author-info-bio-section" th:unless="${privacyUser}">
<div class="section-title not-toc">
<i class="ri-book-open-line"></i>
<span th:text="#{page.author.bio.title}"></span>
</div>
<div class="bio-content" th:if="${!#strings.isEmpty(author.spec.bio)}">
<!-- 将bio内容按段落分割显示 -->
<th:block th:each="paragraph : ${#strings.arraySplit(author.spec.bio, '\\n')}">
<p th:if="${!#strings.isEmpty(paragraph)}" th:text="${paragraph}"></p>
</th:block>
</div>
<div class="bio-content" th:if="${#strings.isEmpty(author.spec.bio)}">
<p><i>[[#{page.author.bio.empty.tip}]]</i></p>
</div>
<!-- 其他信息 -->
<div class="bio-other">
<div class="bio-other-item center">
<i class="ri-sticky-note-line"></i>
<span th:utext="${#messages.msg('page.author.other.posts', '<b>'+posts.total+'</b>')}"></span>
</div>
<th:block th:if="${#annotations.getOrDefault(author, 'show_email', 'hide') == 'show'}">
<div class="bio-other-item center">
<i class="ri-mail-line"></i>
<span th:text="${author.spec.email}"></span>
</div>
</th:block>
<th:block th:if="${author.metadata.creationTimestamp}">
<div class="bio-other-item center">
<i class="ri-time-line"></i>
<span th:text="${#messages.msg('page.author.other.time', #dates.format(author.metadata.creationTimestamp, theme.config.basic_info.global_time_format))}"></span>
</div>
</th:block>
</div>
</div>
</div>
<div class="author-posts" th:unless="${privacyUser}">
<div th:if="${isEmpty}" class="card card-empty" th:with="title=#{global.route.back.home.name},
linkHtml='<a href="/" aria-label="' + ${title} + '" title="' + ${title} + '">' + ${title} + '</a>',
finalMessage=${#messages.msg('page.author.posts.empty.tip', linkHtml)}">
<i class="ri-inbox-2-fill"></i>
[(${finalMessage})]
</div>
<th:block th:unless="${isEmpty}">
<th:block th:replace="~{main/article_list :: articleList (${posts.items})}"/>
<th:block
th:replace="~{main/pagination :: pagination (${posts}, |/authors/${author.metadata.name}|)}"/>
</th:block>
</div>
</div>
</th:block>
</th:block>