{{ define "main" }}
  <main class="post">

    <div class="post-info">
      <p>
        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock">
          <circle cx="12" cy="12" r="10"></circle>
          <polyline points="12 6 12 12 16 14"></polyline>
        </svg>
        {{ i18n "readingTime" .Page.ReadingTime }}

        {{ if .IsTranslated }} | {{ i18n "postAvailable" }}
          {{ range .Translations }}
              <a href="{{ .Permalink }}"><span class="flag fi fi-{{ index $.Site.Data.langFlags (.Lang) }}"></span></a>
          {{ end}}
        {{ end }}
      </p>
    </div>

    <article>
      <h1 class="post-title">
        <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
      </h1>
      {{ if .Params.subtitle }}
      <strong>{{ .Params.subtitle | markdownify }}</strong>{{ if .Params.feathericon
        }}<img style="display: inline-block; vertical-align: middle; margin-left: 4px;"
            src="/feathericons/16px-a9a9b3/{{ print .Params.feathericon }}.svg" alt=""
        >{{ end }}
      {{ end }}
      {{ if (isset .Params "author") }}
      <pre>{{ partial "byline.html" . }}</pre>
      {{ end }}

      {{ with .Params.Description }}
        <div class="post-excerpt">{{ . }}</div>
      {{ end }}

      {{ if .Params.Cover }}
        <figure class="post-cover">
          <img src="{{ .Params.Cover | absURL }}" alt="{{ .Title }}" />

          {{ if .Params.CoverCaption }}
            <figcaption class="center">{{ .Params.CoverCaption | markdownify }}</figcaption>
          {{ end }}
        </figure>
      {{ end }}

      {{- if .Params.toc }}
        <hr />
        <aside id="toc">
          <div class="toc-title">{{ i18n "tableOfContents" }}</div>
          {{ .TableOfContents }}
        </aside>
        <hr />
      {{- end }}

      {{ if .Params.Audio }}
        <div class="post-audio">
          <audio controls>
            <source src="{{ .Params.Audio }}">
          </audio>
        </div>
      {{ end }}

      <div class="post-content">
        {{ if .Params.video }}
          {{ partial "odysee.html" . }}
        {{ end }}

        {{ .Content }}
      </div>
    </article>

    <hr />

    <div class="post-info">
      {{ if .Params.pinned }}
      <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
          src="/feathericons/16px-a9a9b3/paperclip.svg" alt="Pinned:" title="Pinned"
      > <a href="/categories/pinned">This article is pinned.</a>
      {{ end }}
      {{ partial "tags.html" . }}
      {{ partial "series.html" . }}
      {{ partial "categories.html" . }}

      <p>
        <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
            src="/feathericons/16px-a9a9b3/file-text.svg" alt="Word Count:" title="Word Count"
        >
        {{ i18n "wordCount" .Page.WordCount }}
      </p>

      {{ if .Params.Started }}
      <p>
        <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
            src="/feathericons/16px-a9a9b3/book-open.svg" alt="Started Date:" title="Started Date"
        >
        {{ if not (eq .Params.Started .Date )}}
          {{ if .Site.Params.dateformNumTime }}
            {{ i18n "dateStarted" }}{{ dateFormat .Site.Params.dateformNumTime .Params.Started }}
          {{ else }}
            {{ i18n "dateStarted" }}{{ dateFormat "2006-01-02 15:04" .Params.Started }}
          {{ end }}
        {{ end }}
      </p>
      {{ end }}

      <p>
        <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
            src="/feathericons/16px-a9a9b3/calendar.svg" alt="Posted Date:" title="Posted Date"
        >

        {{ if .Site.Params.dateformNumTime }}
          {{ dateFormat .Site.Params.dateformNumTime .Date.Local }}
        {{ else }}
          {{ dateFormat "2006-01-02 15:04" .Date.Local }}
        {{ end }}

        {{ if .Lastmod }}
          {{ if not (eq .Lastmod .Date )}}
            {{ if .Site.Params.dateformNumTime }}
              ({{ i18n "lastModified" }}: {{ dateFormat .Site.Params.dateformNumTime .Lastmod.Local }})
            {{ else }}
              ({{ i18n "lastModified" }}: {{ dateFormat "2006-01-02 15:04" .Lastmod.Local }})
            {{ end }}
          {{ end }}
        {{ end }}
      </p>

      {{ if .Params.release }}
      <p>
        <img style="display: inline-block; vertical-align: middle; margin-right: 4px;"
            src="/feathericons/16px-a9a9b3/globe.svg" alt="Release Date:" title="Release Date"
        >

        {{ if .Site.Params.dateformNumTime }}
          {{ dateFormat .Site.Params.dateformNumTime .Params.release }}
        {{ else }}
          {{ dateFormat "2006-01-02 15:04" .Params.release }}
        {{ end }}
      </p>
      {{ end }}

      {{- if .GitInfo }}
        <p>
          <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit">
            <circle cx="12" cy="12" r="4"></circle>
            <line x1="1.05" y1="12" x2="7" y2="12"></line>
            <line x1="17.01" y1="12" x2="22.96" y2="12"></line>
          </svg>

          <a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash }}</a>
          @ {{ if .Site.Params.dateformNum }}{{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}{{ else }}{{ dateFormat "2006-01-02" .GitInfo.AuthorDate.Local }}{{ end }}
        </p>
      {{- end }}
    </div>

    {{- if .Site.Params.EnableSharingButtons }}
      <hr />
      <div class="sharing-buttons">
        {{ partial "sharing-buttons.html" . }}
      </div>
    {{- end }}

    {{ partial "pagination-single.html" . }}

    {{ if .Site.Config.Services.Disqus.Shortname }}
      {{ if not (eq .Params.Comments "false") }}
        <div id="comments">
          {{ template "_internal/disqus.html" . }}
        </div>
      {{ end }}
    {{ end }}

    {{ if .Site.Params.Commento.Url }}
      <script defer src="{{ .Site.Params.Commento.Url }}"></script>
      <div id="commento"></div>
    {{ end }}

    {{ if .Site.Params.Utterances.Repository }}
    <script src="https://utteranc.es/client.js"
            repo="{{ .Site.Params.Utterances.Repository }}"
            {{ if .Site.Params.Utterances.Label }}label="{{ .Site.Params.Utterances.Label }}"{{ end }}
            issue-term="{{ .Site.Params.Utterances.IssueTerm }}"
            theme="{{ .Site.Params.Utterances.Theme }}"
            crossorigin="anonymous"
            async>
    </script>
    {{ end }}

    {{ if true }}
    <p style="text-align: center;">
      Questions? Comments? Concerns? Email
        {{ partial "email.html" (dict "email" "me@hyperling.com") }}
      any time!
    </p>

    <p style="text-align: center;">
      <small>
        Methods to help support my work can be found at
          <a target="_blank" rel="noopener noreferrer"
            href="https://hyperling.com/donate">hyperling.com/donate</a>.
      </small>
    </p>
    {{ end }}

    {{ if false }}
    <p style="text-align: center;">
      Questions, comments, concerns can be emailed to
        {{ partial "email.html" (dict "email" "me@hyperling.com") }}
      any time!
    </p>

    <p style="text-align: center;">
      <small>
        Feeling generous? Stop by
          <a target="_blank" rel="noopener noreferrer"
            href="https://hyperling.com/donate">hyperling.com/donate</a>
        to help out.
      </p>small>
    </p>
    {{ end }}

  </main>
{{ end }}
