A generic taxonomy list template

This template produces a <ul> list of the terms in the provided taxonomy. The
taxonomy is passed to the template via the `.term` argument, which is a string
name of the taxnomy.
This commit is contained in:
Eryn Wells 2024-07-23 08:48:46 -07:00
parent 64c1704a6b
commit 7ff79c546d
4 changed files with 48 additions and 0 deletions

View file

@ -1,4 +1,7 @@
{{ define "main" }}
<main class="main--single">
<footer class="page-footer">
{{ partial "page/footer.html" . }}
</footer>
</main>
{{ end }}

View file

@ -0,0 +1,2 @@
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "categories") }}
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "tags") }}

View file

@ -0,0 +1,8 @@
{{- $terms := .page.GetTerms .term -}}
{{ with $terms }}
<ul class="taxonomy-list" data-term="{{ $.term }}">
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}