diff options
| -rw-r--r-- | content/articles/automotive-spreadsheets.md | 2 | ||||
| -rw-r--r-- | content/articles/foo.md | 6 | ||||
| -rw-r--r-- | layouts/_partials/articles/header.html | 8 | ||||
| -rw-r--r-- | layouts/_partials/asset-table.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/assets.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/pages.html | 26 | ||||
| -rw-r--r-- | layouts/_partials/taxonomy-url.html | 11 | ||||
| -rw-r--r-- | layouts/_partials/terms.html | 18 | ||||
| -rw-r--r-- | layouts/articles/page.html | 14 | ||||
| -rw-r--r-- | layouts/list.html | 17 | ||||
| -rw-r--r-- | layouts/taxonomy.html | 19 | ||||
| -rw-r--r-- | layouts/term.html | 6 | ||||
| -rw-r--r-- | themes/aoidh/assets/aoidh.css | 2 | ||||
| -rw-r--r-- | themes/aoidh/layouts/_partials/terms.html | 23 |
14 files changed, 103 insertions, 53 deletions
diff --git a/content/articles/automotive-spreadsheets.md b/content/articles/automotive-spreadsheets.md index b3a7587..b4760cc 100644 --- a/content/articles/automotive-spreadsheets.md +++ b/content/articles/automotive-spreadsheets.md @@ -1,7 +1,7 @@ +++ title = 'Automotive Spreadsheets' date = '2026-01-10T17:22:57-05:00' -tags = ["Cars"] +tags = ["cars"] draft = false [assets] 'Spreadsheets' = 'auto/*.ods' diff --git a/content/articles/foo.md b/content/articles/foo.md new file mode 100644 index 0000000..6300edf --- /dev/null +++ b/content/articles/foo.md @@ -0,0 +1,6 @@ ++++ +title = 'Foo' +date = '2026-01-21T15:16:20-05:00' +tags = ["cars", "foo", "bar"] +draft = true ++++ 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 @@ -<h1 class="title">{{ .Title }}</h1> -<p> - {{- partial "date.html" .Date -}} - {{- if gt .Lastmod .Date -}} - — modified {{ partial "date.html" .Lastmod }} - {{- end -}} -</p> -<hr> 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 }} +*/}} + +<table> + <thead> + <tr> + <th>Date</th> + <th>Title</th> + <th><a href="{{ partial "taxonomy-url.html" (dict "taxonomy" "tags" "site" .Site) }}">Tags</a></th> + </tr> + </thead> + <tbody> + {{- range .Pages }} + <tr> + <td>{{ partial "date.html" .Date -}}</td> + <td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td> + <td>{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}</td> + </tr> + {{- end }} + </tbody> +</table> 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: <a href="{{ partial "taxonomy-url.html" (dict taxonomy "tags" "site" .Site }}">tags</a> +*/}} + +{{- $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 -}} + <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> + {{- end -}} +{{- end -}} diff --git a/layouts/articles/page.html b/layouts/articles/page.html index f56c8ea..357cc9f 100644 --- a/layouts/articles/page.html +++ b/layouts/articles/page.html @@ -1,6 +1,16 @@ {{ define "main" }} - {{ partial "articles/header.html" . }} + <h1 class="title">{{ .Title }}</h1> + <p> + {{- partial "date.html" .Date -}} + {{- if gt .Lastmod .Date -}} + — modified {{ partial "date.html" .Lastmod }} + {{- end -}} + <br> + {{- if .Page.GetTerms "tags" }} + Tags: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) -}}. + {{- end }} + </p> + <hr> {{ .Content }} {{ partial "assets" .Params.Assets }} - {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} {{ end }} diff --git a/layouts/list.html b/layouts/list.html index 8c2a19f..43c0bc4 100644 --- a/layouts/list.html +++ b/layouts/list.html @@ -1,19 +1,4 @@ {{ define "main" }} <h1 class="title">{{ .Title }}</h1> - <table> - <thead> - <tr> - <th>Date</th> - <th>Title</th> - </tr> - </thead> - <tbody> - {{ range .Pages }} - <tr> - <td>{{ partial "date.html" .Date -}}</td> - <td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td> - </tr> - {{ end }} - </tbody> - </table> + {{ partial "pages.html" . }} {{ end }} diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html new file mode 100644 index 0000000..ef791e8 --- /dev/null +++ b/layouts/taxonomy.html @@ -0,0 +1,19 @@ +{{ define "main" }} + {{- $taxonomy := .Data -}} + <h1 class="title">{{ .Title }}</h1> + {{ .Content }} + <table> + <thead><tr> + <th>{{ $taxonomy.Singular | humanize }}</th> + <th>Pages</th> + </thead> + <tbody> + {{- range $taxonomy.Terms.ByCount }} + <tr> + <td><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></td> + <td>{{ .Count }}</td> + </tr> + {{- end }} + </tbody> + </table> +{{ end }} diff --git a/layouts/term.html b/layouts/term.html new file mode 100644 index 0000000..2a99edb --- /dev/null +++ b/layouts/term.html @@ -0,0 +1,6 @@ +{{ define "main" }} + {{- $term := .Data -}} + <h1 class="title">Pages with {{ $term.Singular | humanize }} ‘{{ .Title }}’</h1> + {{ .Content }} + {{- partial "pages.html" . -}} +{{ end }} diff --git a/themes/aoidh/assets/aoidh.css b/themes/aoidh/assets/aoidh.css index 0d52fc3..caf22b4 100644 --- a/themes/aoidh/assets/aoidh.css +++ b/themes/aoidh/assets/aoidh.css @@ -154,7 +154,7 @@ th, td { vertical-align: middle; } -th { +th, th * { font-weight: 500; } diff --git a/themes/aoidh/layouts/_partials/terms.html b/themes/aoidh/layouts/_partials/terms.html deleted file mode 100644 index 8a6ebec..0000000 --- a/themes/aoidh/layouts/_partials/terms.html +++ /dev/null @@ -1,23 +0,0 @@ -{{- /* -For a given taxonomy, renders a list of terms assigned to the page. - -@context {page} page The current page. -@context {string} taxonomy The taxonomy. - -@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} -*/}} - -{{- $page := .page }} -{{- $taxonomy := .taxonomy }} - -{{- with $page.GetTerms $taxonomy }} - {{- $label := (index . 0).Parent.LinkTitle }} - <div> - <div>{{ $label }}:</div> - <ul> - {{- range . }} - <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> - {{- end }} - </ul> - </div> -{{- end }} |