Taxonomies list as a tag cloud (#557)

* Taxonomies list as a tag cloud

* Generate resources for demo preview
This commit is contained in:
Codruț Constantin Gușoi
2021-05-06 14:37:55 +01:00
committed by GitHub
parent 67f278f1b4
commit af7360e89a
13 changed files with 112 additions and 6 deletions

View File

@@ -0,0 +1,11 @@
{{ define "title" }}
{{- if eq .Kind "term" -}}
{{- i18n .Data.Singular | title -}}
{{- print ": " -}}
{{- end -}}
{{- .Title }} · {{ .Site.Title -}}
{{ end }}
{{ define "content" }}
{{ partial "terms.html" . }}
{{ end }}

View File

@@ -4,6 +4,8 @@
{{- if gt $index 0 }}
<span class="separator"></span>
{{- end }}
<a href="{{ ( printf "tags/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
<span class="tag">
<a href="{{ ( printf "tags/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a>
</span>
{{- end -}}
</div>

View File

@@ -0,0 +1,28 @@
<section class="container taxonomy">
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{- if eq .Kind "term" -}}
{{- i18n .Data.Singular | title -}}
{{- print ": " -}}
{{- end -}}
{{- i18n (lower .Title) | default .Title | title -}}
</a>
</h1>
{{ .Content }}
<ul>
{{ $type := .Type }}
{{ range $key, $value := .Data.Terms.Alphabetical }}
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<span class="taxonomy-element">
<a href="{{ .Permalink }}">{{ .Name }}</a>
<sup>{{ $count }}</sup>
</span>
</li>
{{ end }}
{{ end }}
</ul>
</section>