{{ define "main" }}
  <div
    class="post {{ with .Site.Params.doNotLoadAnimations }}
      .
    {{ else }}
      animated fadeInDown
    {{ end }}"
  >
    <div class="post__content">
      {{ .Content }}
    </div>

    <!-- (Optional) Home
          -- on top of `mainSections` content (aka posts) ;
          -- as declared in content/_index.md

          One can set `mainSections = [""]` and have the content/_index.md specified here
      -->
  </div>

  {{ if .Params.mainSectionsTitle }}
    <div
      class="post {{ with .Site.Params.doNotLoadAnimations }}
        .
      {{ else }}
        animated fadeInDown
      {{ end }}"
    >
      <div class="post__content">
        <h2>{{ .Params.mainSectionsTitle }}</h2>
      </div>
    </div>
  {{ end }}

  {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
  {{ range $paginator.Pages }}
    <div
      class="post {{ with .Site.Params.doNotLoadAnimations }}
        .
      {{ else }}
        animated fadeInDown
      {{ end }}"
    >
      {{ if .Params.thumbnail }}
        <div class="post__thumbnail-wrapper">
          <a href="{{ .RelPermalink }}">
            <img class="post__thumbnail" src="{{ .Params.thumbnail | relURL }}" alt="Thumbnail image" loading="lazy" />
          </a>
        </div>
      {{ end }}
      <div class="post__content">
        {{ if (eq .Site.Params.disableTitleCapitalization true) }}
          <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
        {{ else }}
          <h3><a href="{{ .RelPermalink }}">{{ upper .Title }}</a></h3>
        {{ end }}
        {{ if .Site.Params.fullPostContent }}
          <p>{{ .Content | safeHTML | plainify }}</p>
        {{ else }}
          <p>{{ .Summary | safeHTML | plainify }}</p>
        {{ end }}
        <!-- add read more -->
        {{- if and (.Truncated) (.Site.Params.readMore) -}}
          <a href="{{ .RelPermalink }}">{{ i18n "read_more" }}</a>
        {{- end -}}
      </div>

      <!--  -->
      <div class="post__footer">
        <em class="fas fa-calendar-day"></em>
        <span class="post__footer-date"
          >{{ if isset .Site.Params "indexdateformat" }}
            {{ if .Site.Params.localizedDates }}
              {{ time.Format .Site.Params.indexDateFormat .Date }}
            {{ else }}
              {{ .Date.Format .Site.Params.indexDateFormat }}
            {{ end }}

          {{ else }}
            {{ if .Site.Params.localizedDates }}
              {{ time.Format "Mon, Jan 2, 2006" .Date }}
            {{ else }}
              {{ .Date.Format "Mon, Jan 2, 2006" }}
            {{ end }}

          {{ end }}</span
        >
        {{ with .Page.Params.Categories }}
          {{ partial "taxonomy/categories.html" . }}
        {{ end }}

        {{ with .Page.Params.Tags }}
          {{ partial "taxonomy/tags.html" . }}
        {{ end }}
      </div>
    </div>
  {{ end }}
  <div class="pagination">
    {{ partial "pagination.html" . }}
  </div>
{{ end }}
