1

Partial pour les listes de mots-clés

This commit is contained in:
2025-11-05 11:29:45 +01:00
parent 4fedc0a056
commit 0f68eb4b2d

View File

@@ -0,0 +1,37 @@
{{- $ctx := . -}}
{{- $scratch := newScratch -}}
{{- $scratch.Set "blocks" 0 -}}
{{- range $taxonomy, $_ := $ctx.Site.Taxonomies -}}
{{- 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 }}
<aside>
{{- range $taxonomy, $_ := $ctx.Site.Taxonomies -}}
{{- with $ctx.Page.GetTerms $taxonomy }}
<section>
<h2>{{ humanize $taxonomy }}</h2>
<ul class="keywords">
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
</section>
{{- end }}
{{- end }}
{{- with $ctx.Params.keywords }}
{{- if gt (len .) 0 }}
<section>
<h2>Mots-clés</h2>
{{- partial "keywords.html" . }}
</section>
{{- end }}
{{- end }}
</aside>
{{- end }}