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: 58a2170114174b98fd9653ad56a31d2efa887a24 (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
{{ 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 }}
        {{- 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 }}
      </div>
    </section>
  </div>
</section>
{{ end }}