From 03211364706ae755a09169414285cdced4432cbe Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Wed, 19 Feb 2025 14:54:37 +0000 Subject: [PATCH] Add counter display for sections on home page --- assets/css/extended/custom.css | 5 +++++ layouts/partials/home_info.html | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/assets/css/extended/custom.css b/assets/css/extended/custom.css index 7c278b0..82e96b6 100644 --- a/assets/css/extended/custom.css +++ b/assets/css/extended/custom.css @@ -28,6 +28,11 @@ code { font-family: "AdwaitaMono", monospace; } +.counter { + color: var(--secondary); + font-size: 0.9rem; +} + :root { --theme: #fafafa; --entry: #ffffff; diff --git a/layouts/partials/home_info.html b/layouts/partials/home_info.html index 6882f39..1178eed 100644 --- a/layouts/partials/home_info.html +++ b/layouts/partials/home_info.html @@ -32,8 +32,18 @@ {{- end }}

{{ .title | default site.Title | markdownify }}

{{ .subtitle | markdownify }} - {{- partial "social_icons.html" -}} + + {{- $grouped := site.RegularPages.GroupBy "Section" -}} + {{- $counters := slice -}} + {{- range $group := $grouped -}} + {{- if $group.Key -}} + {{- $counters = $counters | append (printf "%s: %d" (title $group.Key) (len $group.Pages)) -}} + {{- end -}} + {{- end -}} + {{ delimit $counters " • " }} + + {{- partial "social_icons.html" -}} {{- with .buttons }}
{{- range . }}