aboutsummaryrefslogtreecommitdiff
path: root/layouts/_default/terms.html
blob: e76cde868706e37827fc37ed6843ff106e801177 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{{- define "title" }}{{ T .Data.Plural }} - {{ .Site.Title }}{{ end -}}

{{- define "content" -}}
  {{ $name := .Data.Plural -}}
  {{ $terms := .Data.Terms.ByCount -}}
  {{ $length := len $terms -}}
  {{ if eq $name "categories" -}}
    <div class="terms">
      <div class="terms-title">
        {{ if eq $length 0 -}}
          {{ T "zeroCategoryCounter" }}
        {{- else -}}
          {{ T "categoryCounter" $length }}
        {{- end }}
      </div>
      <div class="terms-tags">
        {{ range $key, $value := $terms -}}
          <a class="terms-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}{{ if $.Site.Params.uglyURLs }}.html{{else}}/{{ end }}">
            {{ $value.Term }}
            <span class="terms-count">{{ len $value.Pages }}</span>
          </a>
        {{ end -}}
      </div>
    </div>
  {{- else if eq $name "tags" -}}
    <div class="terms">
      <div class="terms-title">
        {{ if eq $length 0 -}}
          {{ T "zeroTagCounter" }}
        {{- else -}}
          {{ T "tagCounter" $length }}
        {{- end }}
      </div>
      <div class="terms-tags">
        {{- range $key, $value := $terms }}
          <a class="terms-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}{{ if $.Site.Params.uglyURLs }}.html{{else}}/{{ end }}">
            {{ $value.Term }}
            <span class="terms-count">{{ len $value.Pages }}</span>
          </a>
        {{ end -}}
      </div>
    </div>
  {{- end }}
{{- end }}