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:
parent
64c1704a6b
commit
7ff79c546d
4 changed files with 48 additions and 0 deletions
35
assets/css/099_taxonomy_list.css
Normal file
35
assets/css/099_taxonomy_list.css
Normal file
|
@ -0,0 +1,35 @@
|
|||
{{/*
|
||||
099_taxonomy_list.css
|
||||
Eryn Wells <eryn@erynwells.me>
|
||||
*/}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************
|
||||
* COMPONENT: TAXONOMY LIST
|
||||
***************************/
|
||||
|
||||
.taxonomy-list {
|
||||
--spacing: 1ch;
|
||||
|
||||
display: flex;
|
||||
font-family: var(--font-family-monospace);
|
||||
gap: var(--spacing);
|
||||
list-style-type: none;
|
||||
margin-block: 0;
|
||||
padding-inline-start: 0;
|
||||
|
||||
&::before {
|
||||
color: var(--text-color-secondary);
|
||||
content: attr(data-term) " =";
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
li:not(:last-child)::after {
|
||||
color: var(--text-color-secondary);
|
||||
content: ":";
|
||||
margin-inline-start: var(--spacing);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
{{ define "main" }}
|
||||
<main class="main--single">
|
||||
<footer class="page-footer">
|
||||
{{ partial "page/footer.html" . }}
|
||||
</footer>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
|
2
layouts/partials/page/footer.html
Normal file
2
layouts/partials/page/footer.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "categories") }}
|
||||
{{ partial "page/taxonomy_list.html" (dict "page" . "term" "tags") }}
|
8
layouts/partials/page/taxonomy_list.html
Normal file
8
layouts/partials/page/taxonomy_list.html
Normal 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 }}
|
Loading…
Add table
Add a link
Reference in a new issue