1
Files
2025/themes/2026/layouts/_partials/asides/keywords.html

45 lines
1.4 KiB
HTML

{{- $ctx := . -}}
{{- $scratch := newScratch -}}
{{- $scratch.Set "blocks" 0 -}}
{{- $taxonomyNames := slice -}}
{{- range $taxonomy, $_ := $ctx.Site.Taxonomies -}}
{{- $taxonomyNames = $taxonomyNames | append $taxonomy -}}
{{- end -}}
{{- range sort $taxonomyNames -}}
{{- $taxonomy := . -}}
{{- with $ctx.Page.GetTerms $taxonomy -}}
{{- $scratch.Add "blocks" 1 -}}
{{- end -}}
{{- end -}}
{{- with $ctx.Params.keywords -}}
{{- if gt (len .) 0 -}}
{{- $scratch.Add "blocks" 1 -}}
{{- end -}}
{{- end -}}
{{- if gt ($scratch.Get "blocks") 0 -}}
<section class="article-aside-block article-taxonomies">
<h2>Taxonomies</h2>
<div class="article-taxonomies-groups">
{{- range sort $taxonomyNames -}}
{{- $taxonomy := . -}}
{{- with $ctx.Page.GetTerms $taxonomy -}}
{{- $taxonomyPage := $ctx.Site.GetPage "taxonomy" $taxonomy -}}
<details class="article-taxonomy-group">
<summary class="ui-button">{{ with $taxonomyPage }}{{ .Title }}{{ else }}{{ humanize $taxonomy }}{{ end }}</summary>
{{- partial "keywords.html" . -}}
</details>
{{- end -}}
{{- end -}}
{{- with $ctx.Params.keywords -}}
{{- if gt (len .) 0 -}}
<details class="article-taxonomy-group">
<summary class="ui-button">Mots-clés libres</summary>
{{- partial "keywords.html" . -}}
</details>
{{- end -}}
{{- end -}}
</div>
</section>
{{- end -}}