From d1f332b9cff58b19778fc73080332f7213627cec Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Thu, 16 Oct 2025 14:15:51 +0800 Subject: [PATCH] fix: showDateOnlyInArticle --- layouts/partials/article-meta/basic.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/layouts/partials/article-meta/basic.html b/layouts/partials/article-meta/basic.html index aa374289..de46cced 100644 --- a/layouts/partials/article-meta/basic.html +++ b/layouts/partials/article-meta/basic.html @@ -13,17 +13,19 @@ {{/* Gather partials for this context */}} {{ $shouldShowDate := false }} - {{ if and (eq $scope "single") (.Params.showDateOnlyInArticle | default (.Site.Params.article.showDateOnlyInArticle | default false)) }} - {{ $shouldShowDate = true }} - {{ end }} - - {{/* showDate has higher priority than showDateOnlyInArticle */}} {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }} {{ $shouldShowDate = true }} {{ else }} {{ $shouldShowDate = false }} {{ end }} + {{ if (.Params.showDateOnlyInArticle | default (.Site.Params.article.showDateOnlyInArticle | default false)) }} + {{ if (ne $scope "single") }} + {{/* only takes effect when not called directly in the header of single.html */}} + {{ $shouldShowDate = false }} + {{ end }} + {{ end }} + {{ if $shouldShowDate }} {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} {{ end }}