refactor: make article-list/compact better for term pages (#1289)

* refactor: rename article-time class to article-footer for consistency

* feat: show the number of subpages in `article-compact` when the page is a term
This commit is contained in:
Jimmy
2026-03-05 13:43:55 +01:00
committed by GitHub
parent 230a28fa8d
commit 12f05571cf
4 changed files with 21 additions and 9 deletions
+2 -2
View File
@@ -71,7 +71,7 @@
gap: 8px; gap: 8px;
} }
.article-time, .article-footer,
.article-translations, .article-translations,
.article-header-tags { .article-header-tags {
display: flex; display: flex;
@@ -173,7 +173,7 @@
} }
} }
.article-time { .article-footer {
font-size: 1.4rem; font-size: 1.4rem;
} }
+15 -3
View File
@@ -4,11 +4,23 @@
<h2 class="article-title"> <h2 class="article-title">
{{- .Title -}} {{- .Title -}}
</h2> </h2>
<footer class="article-time">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'> {{- $description := .Params.description -}}
{{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} {{- $IsTerm := in .Kind "term" -}}
{{- if $IsTerm -}}
{{- $description = $description | default (T "list.page" (len .Pages)) -}}
{{- end -}}
{{- if or $description (not .Date.IsZero) -}}
<footer class="article-footer">
{{- if not .Date.IsZero -}}
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date | time.Format .Site.Params.dateFormat.published -}}
</time> </time>
{{- else if $description -}}
<span class="article-description">{{- $description -}}</span>
{{ end }}
</footer> </footer>
{{- end -}}
</div> </div>
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}} {{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}}
@@ -32,7 +32,7 @@
{{ $showDate := not $Page.Date.IsZero }} {{ $showDate := not $Page.Date.IsZero }}
{{ $showFooter := or $showDate $showReadingTime }} {{ $showFooter := or $showDate $showReadingTime }}
{{ if $showFooter }} {{ if $showFooter }}
<footer class="article-time"> <footer class="article-footer">
{{ if $showDate }} {{ if $showDate }}
<div> <div>
{{ partial "helper/icon" "date" }} {{ partial "helper/icon" "date" }}
@@ -6,7 +6,7 @@
<h2 class="article-title"> <h2 class="article-title">
{{- $link.title -}} {{- $link.title -}}
</h2> </h2>
<footer class="article-time"> <footer class="article-footer">
{{ with $link.description }} {{ with $link.description }}
{{ . }} {{ . }}
{{ else }} {{ else }}