From 4fedc0a0563dcb9188bfa14f21b0091d56d06ae2 Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Wed, 5 Nov 2025 10:53:33 +0100 Subject: [PATCH] Taxonomies --- themes/42/assets/css/article-body.css | 5 +++ themes/42/assets/css/index.css | 3 +- themes/42/assets/css/keywords.css | 12 ++++++ themes/42/layouts/_partials/breadcrumbs.html | 40 ++++++++++++++----- themes/42/layouts/_partials/hero-section.html | 2 +- themes/42/layouts/_partials/keywords.html | 13 ++++++ themes/42/layouts/page.html | 2 + themes/42/layouts/taxonomy.html | 11 +++-- themes/42/layouts/term.html | 11 ++--- 9 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 themes/42/assets/css/keywords.css create mode 100644 themes/42/layouts/_partials/keywords.html diff --git a/themes/42/assets/css/article-body.css b/themes/42/assets/css/article-body.css index c28e359d..7d635ee2 100644 --- a/themes/42/assets/css/article-body.css +++ b/themes/42/assets/css/article-body.css @@ -5,6 +5,11 @@ article.article-body { padding: var(--padding) 0; font-size: 1.5rem; + aside { + margin: var(--margin); + font-size: 1.2rem; + } + .stat { max-width: var(--width-content-max); margin: var(--margin) auto; diff --git a/themes/42/assets/css/index.css b/themes/42/assets/css/index.css index d2ff213f..fc1ed36b 100644 --- a/themes/42/assets/css/index.css +++ b/themes/42/assets/css/index.css @@ -24,4 +24,5 @@ @import "table.css"; @import "pagination.css"; @import "table-of-contents.css"; -@import "a.css"; \ No newline at end of file +@import "a.css"; +@import "keywords.css"; \ No newline at end of file diff --git a/themes/42/assets/css/keywords.css b/themes/42/assets/css/keywords.css new file mode 100644 index 00000000..dddb2bc4 --- /dev/null +++ b/themes/42/assets/css/keywords.css @@ -0,0 +1,12 @@ +ul.keywords { + margin: var(--margin) auto; + padding-left: 0; + line-height: 150%; + display: flex; + flex-wrap: wrap; + gap: var(--gap-half); + list-style: none; + max-width: var(--width-content-max); + width: 100%; + font-size: 1rem; +} \ No newline at end of file diff --git a/themes/42/layouts/_partials/breadcrumbs.html b/themes/42/layouts/_partials/breadcrumbs.html index f5c0ec60..79901b47 100644 --- a/themes/42/layouts/_partials/breadcrumbs.html +++ b/themes/42/layouts/_partials/breadcrumbs.html @@ -1,19 +1,39 @@ {{- $page := . -}} -{{- with .Page -}} - {{- $page = . -}} -{{- end -}} -{{- if or $page.IsPage $page.IsSection -}} - {{- $trail := slice -}} +{{- with .Page }}{{ $page = . }}{{ end -}} +{{- $trail := slice -}} +{{- if $page }} {{- range $page.Ancestors.Reverse -}} {{- if ne .RelPermalink "/" -}} {{- $trail = $trail | append . -}} {{- end -}} {{- end -}} - {{- if gt (len $trail) 0 -}} - + {{- else if and (eq $page.Kind "taxonomy") (eq (len $trail) 0) }} + {{- with site.Home }} + {{- if ne .RelPermalink "/" -}} + {{- $trail = $trail | append . -}} + {{- end -}} + {{- end -}} + {{- end }} +{{- end }} + +{{- if gt (len $trail) 0 -}} + {{- end -}} diff --git a/themes/42/layouts/_partials/hero-section.html b/themes/42/layouts/_partials/hero-section.html index ce227697..1a8941d1 100644 --- a/themes/42/layouts/_partials/hero-section.html +++ b/themes/42/layouts/_partials/hero-section.html @@ -1,4 +1,4 @@ -
+
{{ partialCached "site-title.html" . }}
{{ partial "breadcrumbs.html" . }} diff --git a/themes/42/layouts/_partials/keywords.html b/themes/42/layouts/_partials/keywords.html new file mode 100644 index 00000000..3ef9240e --- /dev/null +++ b/themes/42/layouts/_partials/keywords.html @@ -0,0 +1,13 @@ +{{- $items := . -}} +{{- if gt (len $items) 0 -}} + +{{- end }} diff --git a/themes/42/layouts/page.html b/themes/42/layouts/page.html index d51b1302..246a95be 100644 --- a/themes/42/layouts/page.html +++ b/themes/42/layouts/page.html @@ -25,6 +25,8 @@ {{ end }} {{ .Content }} + + {{- partial "asides/keywords.html" . }} {{ end }} diff --git a/themes/42/layouts/taxonomy.html b/themes/42/layouts/taxonomy.html index c2e78751..327a6b55 100644 --- a/themes/42/layouts/taxonomy.html +++ b/themes/42/layouts/taxonomy.html @@ -1,7 +1,10 @@ {{ define "main" }} -

{{ .Title }}

+{{ partial "hero-section.html" . }} +
{{ .Content }} - {{ range .Pages }} -

{{ .LinkTitle }}

- {{ end }} + + {{- with .Pages }} + {{- partial "keywords.html" (.ByTitle) }} + {{- end }} +
{{ end }} diff --git a/themes/42/layouts/term.html b/themes/42/layouts/term.html index c2e78751..980555ea 100644 --- a/themes/42/layouts/term.html +++ b/themes/42/layouts/term.html @@ -1,7 +1,8 @@ {{ define "main" }} -

{{ .Title }}

+{{ partial "hero-section.html" . }} +
{{ .Content }} - {{ range .Pages }} -

{{ .LinkTitle }}

- {{ end }} -{{ end }} + + {{- partial "articles-list.html" (dict "Pages" .Pages.ByDate.Reverse "Context" .) -}} +
+{{ end }} \ No newline at end of file