fix: reading time not displaying in article/components/details partial (#1278)

Fix reading time not displaying due to .Site context in dict partial

The details.html partial receives a dict context via:
  partial "article/components/details" (dict "Page" $Page "IsList" $IsList)

When the dot context is a dict, .Site resolves to nil, so
.Site.Params.article.readingTime always returns empty/false,
causing the reading time to never display.

Lines 40 and 67 of the same file already correctly use
$Page.Site.Params — this fixes line 31 to be consistent.

Co-authored-by: delize <4028612+delize@users.noreply.github.com>
This commit is contained in:
Andrew Doering
2026-03-04 11:58:09 +01:00
committed by GitHub
co-authored by delize
parent 3ca74956a6
commit a0bd0073bb
@@ -28,7 +28,7 @@
{{ end }}
</div>
{{ $showReadingTime := $Page.Params.readingTime | default (.Site.Params.article.readingTime) }}
{{ $showReadingTime := $Page.Params.readingTime | default ($Page.Site.Params.article.readingTime) }}
{{ $showDate := not $Page.Date.IsZero }}
{{ $showFooter := or $showDate $showReadingTime }}
{{ if $showFooter }}