<article itemscope itemtype="http://schema.org/Article" class="article post white-box reveal md <%- theme.custom_css.body.effect.join(' ') %> article-type-<%= post.layout %>" id="<%= post.layout %>" itemscope itemprop="blogPost">
  <link itemprop="mainEntityOfPage" href="<%- decodeURI(post.permalink) %>">
  <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="<%- config.title %>">
  </span>
  <span hidden itemprop="post" itemscope itemtype="http://schema.org/Post">
    <meta itemprop="name" content="<%- config.title %>">
    <meta itemprop="description" content="<%- config.description %>">
  </span>
  <%- partial('meta', {post: post, position: 'top'}) %>
  <div id="layoutHelper-page-plugins"></div>
  <div id="post-body" itemprop="articleBody">
    <%- post.content %>
  </div>
  <% if (page.link) { %>
    <div class='div-ori-link'>
      <a class='ori-link' href='<%- url_for(post.link || post.path) %>'>
        <%- post.link ? __('post.readoriginal') : __('post.readmore') %>
      </a>
    </div>
  <% } %>
  <% if (['post','docs'].includes(page.layout)) { %>
    <% let footer_widget = theme.article.body.footer_widget; %>
    <div class='footer'>
       <!-- 参考资料、相关资料等 -->
      <% if (page.references && page.references.length > 0) { %>
        <div class='references'>
          <section class='header'>
            <% if (footer_widget.references.icon) { %>
              <i class="<%- footer_widget.references.icon %> fa-fw" aria-hidden="true"></i>
            <% } %>
            <span><%- footer_widget.references.title %></span>
          </section>
          <section class='body'>
            <ul>
              <% getList(page.references).forEach(function(row){ %>
                <li>
                  <a href="<%- url_for(row.url) %>" rel="external nofollow noopener noreferrer" target="_blank">
                  <%- row.title || url_for(row.url) %>
                  </a>
                </li>
              <% }) %>
            </ul>
          </section>
        </div>
      <% } %>
       <!-- 相关文章 -->
      <% if (['post'].includes(page.layout) && footer_widget.related_posts && footer_widget.related_posts.enable == true) { %>
        <%-
        htmlGenerator(
          popular_posts_json({ maxCount: footer_widget.related_posts.max_count , ulClass: 'vlts-rps' , PPMixingRate: 0.2 , isImage: true , isExcerpt: true} , post )
        )
        %>
      <% } %>
      <!-- 版权声明组件 -->
      <% if (['post'].includes(page.layout) && footer_widget.copyright && footer_widget.copyright.enable == true && post.copyright != false) { %>
        <% if (footer_widget.copyright.custom) { %>
          <%
            let author = theme.article.body.meta_library.author;
            let aid = post.author;
            if (aid && site.data && site.data.author && (aid in site.data.author)) {
              author = site.data.author[aid];
            }
            let articleCreate =  date(post.date, theme.article.body.meta_library.date.format);
            let articleUpdate = date(post.updated, theme.article.body.meta_library.updated.format);
            let copyrightRule = post.copyright?.type || theme.article.body.footer_widget.copyright.customData.default;
            let copyrightRuleText = theme.article.body.footer_widget.copyright.customData.rules[copyrightRule]?.text;
            let copyrightRuleDesc = theme.article.body.footer_widget.copyright.customData.rules[copyrightRule]?.desc;
          %>
          <div class="copyright license">
            <div class="license-title"><%- post.title %></div>
            <div class="license-link"><a href="<%- decodeURI(page.permalink) %>"><%- decodeURI(page.permalink) %></a>
            </div>
            <div class="license-meta">
              <div class="license-meta-item">
                <div class="license-meta-title"><%- __('post.copyright.author') %></div>
                <div class="license-meta-text"><%- post.copyright?.author || author.name %></div>
              </div>
              <div class="license-meta-item">
                <div class="license-meta-title"><%- __('post.copyright.date') %></div>
                <div class="license-meta-text"><%- articleCreate %></div>
              </div>
              <% if (articleCreate !== articleUpdate) { %>
              <div class="license-meta-item">
                <div class="license-meta-title"><%- __('post.copyright.updated') %></div>
                <div class="license-meta-text"><%- articleUpdate %></div>
              </div>
              <% } %>
              <% if (post.copyright?.ref?.title) { %>
              <div class="license-meta-item">
                <div class="license-meta-title"><%- __('post.copyright.references') %></div>
                <div class="license-meta-text">
                  <a href="<%- post.copyright.ref?.url %>" target="_blank"><%- post.copyright.ref?.title %></a>
                </div>
              </div>
              <% } %>
              <div class="license-meta-item">
                <div class="license-meta-title"><%- __('post.copyright.license') %></div>
                <div class="license-meta-text"><%- copyrightRuleText %></div>
              </div>
            </div>
            <div class="license-statement"><%- copyrightRuleDesc %></div>
          </div>
        <% } else { %>
          <div class='copyright'>
            <blockquote>
              <% getList(footer_widget.copyright.content).forEach(function(row){ %>
                <% if (row == 'permalink') { %>
                  <p><%- footer_widget.copyright.permalink %><a href="<%- decodeURI(page.permalink) %>"><%- decodeURI(page.permalink) %></a></p>
                <% } else { %>
                  <%- markdown(row) %>
                <% } %>
              <% }) %>
            </blockquote>
          </div>
        <% } %>
      <% } %>
      <!-- 打赏组件 -->
      <% if (['post'].includes(page.layout) && footer_widget.donate && footer_widget.donate.enable == true) { %>
        <div class='donate'>
          <div class='imgs'>
            <% getList(footer_widget.donate.images).forEach(function(url){ %>
              <img src='<%- url_for(url) %>'>
            <% }) %>
          </div>
        </div>
      <% } %>
    </div>
  <% } %>
  <% if (['page', 'post', 'docs'].includes(post.layout)) { %>
    <%- partial('meta', {post: post, position: 'bottom'}) %>
  <% } %>
  <% if ((post.group != undefined) && (post.order != undefined)) { %>
    <%
    let prev = new Object();
    let next = new Object();
    site.pages.each(function(p){
      if ((p.title || p.seo_title) && p.path && (p.group == post.group)) {
        if (p.order < post.order && (p.order > prev.order || prev.order == undefined)) {
          prev = {title: p.title || p.seo_title, exp: truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
        }
        if (p.order > post.order && (p.order < next.order || next.order == undefined)) {
          next = {title: p.title || p.seo_title, exp: truncate(strip_html(p.content), {length: 100}), path: p.path, order: p.order};
        }
      }
    })
    %>
    <% if (['docs'].includes(post.layout) && (prev || next)) { %>
      <div class="prev-next">
        <% if (prev.path) { %>
          <a class='prev' href='<%- url_for(prev.path) %>'>
            <p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i><%- prev.title || '' %></p>
            <p class='content'><%- prev.exp %></p>
          </a>
        <% } %>
        <% if (next.path) { %>
          <a class='next' href='<%- url_for(next.path) %>'>
            <p class='title'><%- next.title || '' %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
            <p class='content'><%- next.exp %></p>
          </a>
        <% } %>
      </div>
    <% } %>
  <% } %>

  <% if (post.prev || post.next) { %>
    <div class="prev-next">
      <% if (post.prev) { %>
        <a class='prev' href='<%- url_for(post.prev.path) %>'>
          <p class='title'><i class="fa-solid fa-chevron-left" aria-hidden="true"></i><%- post.prev.title || post.prev.seo_title || date(post.date, theme.article.body.meta_library.date.format) %></p>
          <p class='content'><%- truncate(strip_html(page.prev.content), {length: 100}) %></p>
        </a>
      <% } %>
      <% if (post.next) { %>
        <a class='next' href='<%- url_for(post.next.path) %>'>
          <p class='title'><%- post.next.title || post.next.seo_title || date(post.date, theme.article.body.meta_library.date.format) %><i class="fa-solid fa-chevron-right" aria-hidden="true"></i></p>
          <p class='content'><%- truncate(strip_html(page.next.content), {length: 100}) %></p>
        </a>
      <% } %>
    </div>
  <% } %>
  <!-- 文章推荐 -->
  <% let footer_widget = theme.article.body.footer_widget; %>
  <% if (footer_widget.recommended_article && footer_widget.recommended_article.enable == true && footer_widget.recommended_article.layout.includes(page.layout) && !page.skip_recommended_article) { %>
    <%- 文章推荐生成器(post) %>
  <% } %>
  <!-- Custom Files postEnd begin-->
  <%- volantis_inject('postEnd') %>
  <!-- Custom Files postEnd end-->
</article>

<% if (page.comments == undefined || page.comments != false) { %>
  <%- partial('../_plugins/comments/index') %>
<% } %>

