hugo-theme-even/layouts/_default/terms.html
2017-08-27 22:38:42 +08:00

45 lines
No EOL
1.5 KiB
HTML

{{ 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 }}/{{ $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 }}/{{ $value.Term | urlize }}/">
{{ $value.Term }}
<span class="tag-count">{{ len $value.Pages }}</span>
</a>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}