<% if (theme.search == true && page.type == 'search') { %>
  <%- partial('_partial/search') %>
<% } else if (page.type == 'tags') { %>
  <%- partial('_partial/tags') %>
<% } else if (page.type == 'categories') { %>
  <%- partial('_partial/categories') %>
<% } else { %>
<article class="post">
  <% if (page.cover_image) { %>
  <div class="cover">
    <img src="<%= page.cover_image %>" alt="<%= page.cover_image_alt %>" class="cover-img" data-pagefind-meta="image[src], image_alt[alt]" />
  </div>
  <% } %>
  <div class="meta">
    <% if (page.categories && page.categories.length) { %>
    <div class="categories<%= theme.uppercase_categories ? ' text-uppercase' : '' %>">
    <% page.categories.forEach((category) => { %>
      <a href="<%= config.root + category.path %>"><%= category.name %></a>
    <% }) %>
    </div>
    <% } %>

    <% if (!page.no_date) { %>
    <time class="date" datetime="<%- moment(page.date).format() %>">
      <%- moment(page.date).format(theme.date_display_format) %>
    </time>
    <% } %>

    <h1 class="title" data-pagefind-meta="title"><%= page.title %></h1>
  </div>

  <div class="content">
    <%- page.content %>
  </div>

  <% if (!page.no_about) { %>
  <div class="about" data-pagefind-ignore>
    <h2><%= __('about_this_post') %></h2>
    <div class="details"><%- __('this_post_is_written_by_licensed_under', { author: config.author, license: `<a href="${theme.license_link}">${theme.license}</a>` }) %></div>
    <% if (page.tags && page.tags.length) { %>
    <p class="tags<%= theme.capitalize_tags ? ' text-capitalize' : '' %>">
      <i class="bi bi-tags icon"></i>
      <% page.tags.forEach(tag => { %>
      <a href="<%- url_for(tag.path) %>" class="tag"><% if (theme.hashtag_prefix_before_tags) { %>#<% } %><%- tag.name %></a>
      <% }) %>
    </p>
    <% } %>
    <% if (page.about_extra_description) { %><div class="extra"><%- page.about_extra_description %></div><% } %>
  </div>
  <% } %>

  <div class="container post-prev-next" data-pagefind-ignore>
    <% if (page.prev) { %>
    <a href="<%= url_for(page.prev.path) %>" class="next">
      <div class="text">
        <p class="label"><%= __('next_post') %></p>
        <h3 class="title"><%= page.prev.title %></h3>
      </div>
    </a>
    <% } else { %><a class="next"></a><% } %>
    <% if (page.next) { %>
    <a href="<%= url_for(page.next.path) %>" class="prev">
      <div class="text">
        <p class="label"><%= __('prev_post') %></p>
        <h3 class="title"><%= page.next.title %></h3>
      </div>
    </a>
    <% } else { %><a class="prev"></a><% } %>
  </div>

  <% if (!page.no_comments) { %>
    <%- theme.insertions.comments_section %>
  <% } %>
</article>
<% } %>
