aboutsummaryrefslogtreecommitdiff
path: root/layouts/_default/terms.html
blob: fbf00454a59ce026175d1ade78b91f3715607759 (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
45
{{ define "title" }}{{ index .Site.Data.even.default .Data.Plural }} - {{ .Site.Title }}{{ end }}

{{ define "content" }}
  {{ $lang := .Site.Data.even.default -}}
  {{ $name := .Data.Plural -}}
  {{ $terms := .Data.Terms.ByCount -}}
  {{ $length := len $terms -}}
  {{ if eq $name "categories" }}
    <div class="categories">
      <div class="categories-title">
        {{ if eq $length 0 }}
          {{ $lang.counter.categories.zero }}
        {{ else }}
          {{ printf $lang.counter.categories.other $length }}
        {{ end }}
      </div>
      <div class="categories-tags">
        {{ range $key, $value := $terms }}
          <a class="category-link" href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
            {{ $value.Term }}
            <span class="category-count">{{ len $value.Pages }}</span>
          </a>
        {{ end }}
      </div>
    </div>
  {{ else if eq $name "tags" }}
    <div class="tag-cloud">
      <div class="tag-cloud-title">
          {{ if eq $length 0 }}
          {{ $lang.counter.tagcloud.zero }}
        {{ else }}
          {{ printf $lang.counter.tagcloud.other $length}}
        {{ end }}
      </div>
      <div class="tag-cloud-tags">
        {{ range $key, $value := $terms }}
          <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
            {{ $value.Term }}
            <span class="tag-count">{{ len $value.Pages }}</span>
          </a>
        {{ end }}
      </div>
    </div>
  {{ end }}
{{ end }}