<!doctype html>
<html
  xmlns:th="https://www.thymeleaf.org"
  th:replace="~{modules/layout :: html(content = ~{::content}, showAside = ${theme.config.custom.enable_post_toc != false and #annotations.getOrDefault(post, 'toc', 'true') == 'true'}, pageTitle = null, head = ~{::head})}"
>
  <th:block th:fragment="content">
    <!-- 文章头部 -->
    <th:block th:replace="~{modules/post/post-header :: post-header(post=${post}, theme=${theme}, site=${site})}" />
    <!-- 文章摘要 -->
    <th:block th:replace="~{modules/post/excerpt :: excerpt(post=${post}, theme=${theme})}" />
    <!-- 文章过期提示 -->
    <th:block th:replace="~{modules/post/outdated-notice :: outdated-notice(post=${post}, theme=${theme})}" />
    <!-- 文章 AI 提示 -->
    <th:block th:replace="~{modules/post/ai-notice :: ai-notice(post=${post})}" />
    <!-- 文章内容 -->
    <article class="article" th:utext="${post.content.content}"></article>
    <!-- 文章页脚 -->
    <th:block th:replace="~{modules/post/post-footer :: post-footer(post=${post}, theme=${theme})}" />
    <!-- 文章导航 -->
    <th:block
      th:replace="~{modules/post/cursor-post :: cursor-post(post=${post}, theme=${theme}, postFinder=${postFinder})}"
    />
    <!-- 评论区 -->
    <th:block
      th:replace="~{modules/common/comment :: comment(title='评论区', haloComment=${ {group: 'content.halo.run', kind: 'Post', name: post.metadata.name} })}"
    ></th:block>
    <!-- 编辑文章按钮 -->
    <button
      id="edit-post-btn"
      class="edit-post-btn"
      th:if="${theme.config.custom.enable_edit and #authentication != null and #authentication.authenticated and #authentication.name == post.owner.name}"
      th:data-url="@{${'/console/posts/editor'}(name=${post.metadata.name}, returnToView=true)}"
      title="编辑文章"
    >
      <span class="icon-[ph--pencil-bold]"></span>
    </button>
    <!-- 文章海报弹窗 -->
    <th:block th:replace="~{modules/post/poster-modal :: poster-modal(post=${post}, site=${site}, theme=${theme})}" />
    <!-- 文章脚本 -->
    <th:block th:replace="~{modules/post/script :: script(post=${post}, site=${site}, theme=${theme})}" />
  </th:block>
</html>
