1{{- /*
2For a given taxonomy, renders a list of terms assigned to the page.
3
4@context {page} page The current page.
5@context {string} taxonomy The taxonomy.
6
7@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
8*/}}
9
10{{- $page := .page }}
11{{- $taxonomy := .taxonomy }}
12
13{{- $terms := $page.GetTerms $taxonomy }}
14{{- if $terms }}
15 {{- $label := (index $terms 0).Parent.LinkTitle | default "Tags" }}
16 {{- $rawMap := dict }}
17 {{- with $page.Param $taxonomy }}
18 {{- range . }}
19 {{- $slug := urlize . }}
20 {{- $rawMap = merge $rawMap (dict $slug .) }}
21 {{- end }}
22 {{- end }}
23 <div class="post-tags">
24 <span class="post-tags__label">{{ $label }}:</span>
25 <ul class="post-tags__list">
26 {{- range $terms }}
27 {{- $slug := urlize .LinkTitle }}
28 {{- $name := index $rawMap $slug | default .LinkTitle }}
29 <li><a href="{{ .RelPermalink }}">{{ $name }}</a></li>
30 {{- end }}
31 </ul>
32 </div>
33{{- end }}