From 7e971e862a43361ec77c3b2c7a4345dd9e771784 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 21 Jan 2026 13:32:40 -0500 Subject: add tables of assets to article/page template --- content/articles/automotive-spreadsheets.md | 3 ++- layouts/_partials/assets.html | 12 ++++++++++++ layouts/articles/automotive-spreadsheets.html | 6 ------ layouts/articles/page.html | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 layouts/_partials/assets.html delete mode 100644 layouts/articles/automotive-spreadsheets.html diff --git a/content/articles/automotive-spreadsheets.md b/content/articles/automotive-spreadsheets.md index f14cd0f..b3a7587 100644 --- a/content/articles/automotive-spreadsheets.md +++ b/content/articles/automotive-spreadsheets.md @@ -3,7 +3,8 @@ title = 'Automotive Spreadsheets' date = '2026-01-10T17:22:57-05:00' tags = ["Cars"] draft = false -layout = "automotive-spreadsheets" +[assets] + 'Spreadsheets' = 'auto/*.ods' +++ Collection of spreadsheets for calculating suspension dynamics, brake bias, and so on. diff --git a/layouts/_partials/assets.html b/layouts/_partials/assets.html new file mode 100644 index 0000000..6930496 --- /dev/null +++ b/layouts/_partials/assets.html @@ -0,0 +1,12 @@ +{{- /* +Render a list of tables of assets. + +@context {.} dict Mapping from section titles to asset glob patterns. + +@examle: {{ partial "assets.html" (dict "Spreadsheets" "auto/*.ods") }} +*/}} + +{{- range $title, $pattern := . -}} +

{{ strings.FirstUpper $title }}

+ {{ partial "asset-table.html" (resources.Match $pattern) }} +{{- end -}} diff --git a/layouts/articles/automotive-spreadsheets.html b/layouts/articles/automotive-spreadsheets.html deleted file mode 100644 index b2e27ab..0000000 --- a/layouts/articles/automotive-spreadsheets.html +++ /dev/null @@ -1,6 +0,0 @@ -{{ define "main" }} - {{ partial "articles/header.html" . }} - {{ .Content }} - {{ partial "asset-table.html" (resources.Match "auto/*.ods") }} - {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} -{{ end }} diff --git a/layouts/articles/page.html b/layouts/articles/page.html index e15623e..f56c8ea 100644 --- a/layouts/articles/page.html +++ b/layouts/articles/page.html @@ -1,5 +1,6 @@ {{ define "main" }} {{ partial "articles/header.html" . }} {{ .Content }} + {{ partial "assets" .Params.Assets }} {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} {{ end }} -- cgit v1.2.3