Add counter display for sections on home page

This commit is contained in:
2025-02-19 14:54:37 +00:00
parent f82c35adbd
commit 0321136470
2 changed files with 16 additions and 1 deletions

View File

@@ -28,6 +28,11 @@ code {
font-family: "AdwaitaMono", monospace; font-family: "AdwaitaMono", monospace;
} }
.counter {
color: var(--secondary);
font-size: 0.9rem;
}
:root { :root {
--theme: #fafafa; --theme: #fafafa;
--entry: #ffffff; --entry: #ffffff;

View File

@@ -32,8 +32,18 @@
{{- end }} {{- end }}
<h1>{{ .title | default site.Title | markdownify }}</h1> <h1>{{ .title | default site.Title | markdownify }}</h1>
<span>{{ .subtitle | markdownify }}</span> <span>{{ .subtitle | markdownify }}</span>
{{- partial "social_icons.html" -}}
<!-- Counter -->
{{- $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 -}}
<span class="counter">{{ delimit $counters " • " }}</span>
{{- partial "social_icons.html" -}}
{{- with .buttons }} {{- with .buttons }}
<div class="buttons"> <div class="buttons">
{{- range . }} {{- range . }}