halo-theme-hao/templates/post.html

249 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'post')}"
xmlns:th="http://www.thymeleaf.org">
<th:block th:fragment="content">
<div class="post" id="body-wrap">
<header class="post-bg" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = ${post.spec.title})}"></nav>
<div class="coverdiv" id="coverdiv">
<img alt="cover" class="nolazyload" id="post-cover"
th:src="${#strings.isEmpty(post.spec.cover) ? theme.config.layout.postRandomImg : post.spec.cover}">
</div>
<div id="post-info">
<div id="post-firstinfo">
<div class="meta-firstline">
<!-- 这里要跳转到版权页 -->
<!--<a class="post-meta-original" th:href="@{/cc}" title="该文章为原创文章,注意版权协议">原创</a>-->
<span class="post-meta-categories"
th:each="category : ${post.categories}"
th:if="${not #lists.isEmpty(post.categories)}">
<a class="post-meta-categories"
th:href="@{${category.status.permalink}}"
th:text="${category.spec.displayName}"
th:title="${category.spec.displayName}">
</a>
</span>
<div class="tag_share" th:if="${not #lists.isEmpty(post.tags)}">
<div class="post-meta__tag-list">
<a class="post-meta__tags"
th:each="tag : ${post.tags}"
th:href="@{${tag.status.permalink}}"
th:text="'#'+${tag.spec.displayName}"
th:title="${tag.spec.displayName}"></a>
</div>
</div>
</div>
</div>
<h1 class="post-title" th:text="${post.spec.title}"></h1>
<div id="post-meta">
<div class="meta-secondline">
<span class="post-meta-date">
<i class="post-meta-icon fa-fw fas fa-calendar"></i>
<time th:attr="datetime=${#dates.format(post.spec.publishTime, 'yyyy-MM-dd')}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd')}">
</time>
</span>
<span class="post-meta-position" title="作者IP归属地为中国">
<i class="fas fa-location-dot post-meta-icon"></i>
<span>中国</span>
</span>
<span class="post-meta-wordcount" th:with="wordCount = ${#strings.length(post.content.content)}">
<i class="fas fa-file-word fa-fw post-meta-icon" title="文章字数"></i></i>
<span class="word-count" th:text="${{wordCount}}"></span>
</span>
<span class="post-meta-time" th:with="wordCount = ${#strings.length(post.content.content)}">
<i class="fas fa-clock post-meta-icon" title="阅读耗时"></i>
<span>[[${wordCount / 400}]] min</span>
</span>
<span class="post-meta-pv" title="文章热度">
<i class="fab fa-hotjar fa-fw post-meta-icon"></i>
<span id="twikoo_visitors" th:text="${post.stats.visit}"></span>
</span>
<span class="post-meta-commentcount" onclick="heo.scrollTo('#post-comment');" title="评论数">
<i class="fa-solid fa-message"></i>
<a data-pjax-state="" href="#post-comment">
<span id="twikoo-count" th:text="${post.stats.comment}"></span>
</a>
</span>
</div>
</div>
</div>
<section class="main-hero-waves-area waves-area">
<svg class="waves-svg" preserveAspectRatio="none"
shape-rendering="auto" viewBox="0 24 150 28" xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
<defs>
<path d="M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z"
id="gentle-wave"></path>
</defs>
<g class="parallax">
<use href="#gentle-wave" x="48" y="0"></use>
<use href="#gentle-wave" x="48" y="3"></use>
<use href="#gentle-wave" x="48" y="5"></use>
<use href="#gentle-wave" x="48" y="7"></use>
</g>
</svg>
</section>
</header>
<main class="layout" id="content-inner" th:classappend="${theme.config.sidebar.location}">
<div id="post">
<!-- 文章内容 -->
<article class="post-content line-numbers" id="article-container" th:utext="${post.content.content}"></article>
<div class="post-tools" id="post-tools">
<div class="post-tools-left">
<!-- 分享 -->
<div class="share-link mobile">
<div class="share-qrcode">
<div class="share-button" title="使用手机访问这篇文章">
<i class="fas fa-qrcode"></i>
</div>
<div class="share-main">
<div class="share-main-all">
<div id="qrcode" th:title="${post.status.permalink}">
</div>
<div class="reward-dec">使用手机访问这篇文章</div>
</div>
</div>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), [[${post.status.permalink}]]);
</script>
</div>
</div>
<div class="share-link weibo">
<a class="share-button"
rel="noopener external nofollow noreferrer noopener"
target="_blank"
th:href="'https://service.weibo.com/share/share.php?title=' + ${post.spec.title} + 'url=' + ${post.status.permalink} + 'pic=' + ${post.spec.cover}"
title="分享到微博">
<i class="fab fa-weibo" style="font-size:22px"></i>
</a>
</div>
<div class="share-link copyurl">
<div class="share-button" id="post-share-url" onclick="acrylic.copyPageUrl()" title="复制链接">
<i class="fas fa-link"></i>
</div>
</div>
</div>
<div class="post-tools-right">
<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}}">
<span class="tags-punctuation">#</span>
<th:block th:text="${tag.spec.displayName}"
th:title="${tag.spec.displayName}"></th:block>
<span class="tagsPageCount" th:text="${tag.status.visiblePostCount}"></span>
</a>
</div>
</div>
</div>
</div>
<!-- 版权声明 -->
<div class="post-copyright" th:if="${theme.config.post.copyright}">
<div class="post-copyright__author">
<!-- 版权页 以及版权描述文字 -->
<a class="post-copyright__original" th:href="@{${theme.config.basics.copyrightAgreement}}"
title="该文章为原创文章,注意版权协议">原创</a>
<a class="post-copyright-title" href="#"><span th:text="${post.spec.title}"></span></a>
</div>
<div class="post-copyright__type">
<span class="post-copyright-info" id="post-copyright-url">
<a href="javascript:window.location.href;">[[${post.spec.title}]]</a>
</span>
<button class="post-copyright-copybtn" onclick="acrylic.copyPageUrl()">
<i class="fas fa-paste copy-btn"></i>
</button>
</div>
<div class="post-copyright__notice">
<span class="post-copyright-info" th:utext="${theme.config.post.copyrightInfo}"></span>
</div>
</div>
<nav class="pagination-post" id="pagination"
th:with="postCursor = ${postFinder.cursor(post.metadata.name)}">
<div class="prev-post pull-left">
<a th:href="@{${postCursor.previous.status.permalink}}" th:if="${postCursor.hasPrevious()}">
<div class="pagination-info">
<div class="label">上一篇</div>
<div class="prev_info" th:text="${postCursor.previous.spec.title}"></div>
</div>
</a>
</div>
<div class="next-post pull-right">
<a th:href="@{${postCursor.next.status.permalink}}" th:if="${postCursor.hasNext()}">
<div class="pagination-info">
<div class="label">下一篇</div>
<div class="next_info" th:text="${postCursor.next.spec.title}"></div>
</div>
</a>
</div>
</nav>
<div class="relatedPosts" th:if="${not #lists.isEmpty(post.categories)}">
<div class="headline">
<i class="fa-solid fa-robot"></i>
<span>阅读建议</span>
</div>
<div class="relatedPosts-list"
th:with="recommandPosts = ${postFinder.listByCategory(1, theme.config.post.recommendQuantity, post.categories.get(0).metadata.name)}">
<!-- 建议阅读,这里可以自定义文章数量,然后遍历展示 -->
<div th:each="recommandPost :${recommandPosts}">
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
<img alt="cover" class="cover entered loading" loading="lazy"
th:src="${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}">
<div class="content is-center">
<div class="date"><i class="far fa-calendar-alt fa-fw"></i>
[[${#dates.format(recommandPost.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}]]
</div>
<div class="title" th:text="${recommandPost.spec.title}"></div>
</div>
</a>
</div>
</div>
</div>
<hr>
<!-- 评论模块 -->
<div id="post-comment" th:if="${pluginFinder.available('PluginCommentWidget')}">
<div class="comment-head">
<div class="comment-headline">
<i class="fa-sharp fa-regular fa-comment"></i>
<span>评论</span>
</div>
<div class="comment-privacy"><a href="#">隐私政策</a></div>
<div class="comment-tips" id="comment-tips">
<span>你无需删除空行,直接评论以获取最佳展示效果</span>
</div>
</div>
<halo:comment colorScheme="document.documentElement.getAttribute('data-theme')" group="content.halo.run" kind="Post"
th:attr="name=${post.metadata.name}"/>
</div>
</div>
<!-- 侧栏 -->
<div th:replace="~{modules/aside :: aside(${theme.config.sidebar.postWidgets})}"></div>
</main>
<!-- 底部 -->
<footer th:replace="~{modules/footer :: footer}"></footer>
</div>
</th:block>
</html>