Welcome to mirror list, hosted at ThFree Co, Russian Federation.

archives.html « _default « layouts - github.com/wayjam/hugo-theme-mixedpaper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 421e8ea0a3f4ba5e3aae6a6a286f371eebd83104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{{ define "main" }}
<!-- All of the site's posts grouped by year -->
<section id="main">
  <div class="container">
    <section id="archives" class="post_list content">
      <div class="listing">
        {{ $paginator := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) (.Site.Params.listPaginate | default 20) }}
        {{ if $paginator }}
          {{- range $index, $element := $paginator.Pages -}}
          {{- $thisYear := $element.Date.Format "2006" }}
          {{- $lastElement := $index | add -1 | index $paginator.Pages }}
          {{- if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }}
          <div class="collection-title">
            <h3 class="archive-year">{{ $thisYear }}</h3>
          </div>
          {{- end }}
          <div class="archive-post line_item item">
            <a href="{{ .RelPermalink }}" title="{{ .Title }}">
              <span>{{ .Title }}</span>
              <span class="date">{{ $element.Date.Format "01-02" }}</span>
            </a>
          </div>
          {{- end }}
        {{ end }}
      </div>
    </section>
    {{ partial "pagination.html" . }}
  </div>
</section>
{{ end }}