hugo-theme-even/layouts/_default/terms.html

44 lines
1.4 KiB
HTML

{{- 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 }}