From 8f0a341644fb0d9575b5429ca6193609a4d12d02 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 21 Jan 2026 17:34:37 -0500 Subject: tags --- layouts/_partials/articles/header.html | 8 -------- layouts/_partials/asset-table.html | 2 +- layouts/_partials/assets.html | 2 +- layouts/_partials/pages.html | 26 ++++++++++++++++++++++++++ layouts/_partials/taxonomy-url.html | 11 +++++++++++ layouts/_partials/terms.html | 18 ++++++++++++++++++ 6 files changed, 57 insertions(+), 10 deletions(-) delete mode 100644 layouts/_partials/articles/header.html create mode 100644 layouts/_partials/pages.html create mode 100644 layouts/_partials/taxonomy-url.html create mode 100644 layouts/_partials/terms.html (limited to 'layouts/_partials') diff --git a/layouts/_partials/articles/header.html b/layouts/_partials/articles/header.html deleted file mode 100644 index e415b89..0000000 --- a/layouts/_partials/articles/header.html +++ /dev/null @@ -1,8 +0,0 @@ -

{{ .Title }}

-

- {{- partial "date.html" .Date -}} - {{- if gt .Lastmod .Date -}} - — modified {{ partial "date.html" .Lastmod }} - {{- end -}} -

-
diff --git a/layouts/_partials/asset-table.html b/layouts/_partials/asset-table.html index d5e893c..df47501 100644 --- a/layouts/_partials/asset-table.html +++ b/layouts/_partials/asset-table.html @@ -6,7 +6,7 @@ have a corresponding .moddate file, e.g., assets/foo/bar.txt and assets/foo/bar.txt.moddate containing "1999-01-02". This is to preserve the modification times of files when the repository is cloned. -@context {.} resource.Resources +@context {resource.Resources} . @example: {{ partial "asset-table.html" (resources.Match "spreadsheets/*.ods") }} */}} diff --git a/layouts/_partials/assets.html b/layouts/_partials/assets.html index 6930496..8bb5d2a 100644 --- a/layouts/_partials/assets.html +++ b/layouts/_partials/assets.html @@ -1,7 +1,7 @@ {{- /* Render a list of tables of assets. -@context {.} dict Mapping from section titles to asset glob patterns. +@context {dict} . Mapping from section titles to asset glob patterns. @examle: {{ partial "assets.html" (dict "Spreadsheets" "auto/*.ods") }} */}} diff --git a/layouts/_partials/pages.html b/layouts/_partials/pages.html new file mode 100644 index 0000000..6a7dc16 --- /dev/null +++ b/layouts/_partials/pages.html @@ -0,0 +1,26 @@ +{{- /* +Renders a table of pages. + +@context {Page} . Current page. + +@example: {{ partial "page-list.html" .Pages }} +*/}} + + + + + + + + + + + {{- range .Pages }} + + + + + + {{- end }} + +
DateTitleTags
{{ partial "date.html" .Date -}}{{ .LinkTitle }}{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
diff --git a/layouts/_partials/taxonomy-url.html b/layouts/_partials/taxonomy-url.html new file mode 100644 index 0000000..259cc9b --- /dev/null +++ b/layouts/_partials/taxonomy-url.html @@ -0,0 +1,11 @@ +{{- /* +Renders the URL of a taxonomy page. + +@context {string} taxonomy Name of the taxonomy. +@context {site} site The site. + +@example: tags +*/}} + +{{- $taxonomy := index .site.Taxonomies .taxonomy -}} +{{- $taxonomy.Page.RelPermalink -}} diff --git a/layouts/_partials/terms.html b/layouts/_partials/terms.html new file mode 100644 index 0000000..afe3a14 --- /dev/null +++ b/layouts/_partials/terms.html @@ -0,0 +1,18 @@ +{{- /* +For a given taxonomy, renders a comma-separated list of terms assigned to the page. + +@context {string} taxonomy The taxonomy. +@context {page} page The current page. + +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +*/}} + +{{- $taxonomy := .taxonomy }} +{{- $page := .page }} + +{{- with $page.GetTerms $taxonomy -}} + {{- range $index, $term := . -}} + {{- if $index }}, {{ end -}} + {{ .LinkTitle }} + {{- end -}} +{{- end -}} -- cgit v1.2.3