From c3fbfc9545ab90de86dcf5727d929b74411e2029 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Wed, 11 Jun 2025 18:31:15 +0800 Subject: [PATCH] fix: date still shown when showDate=false --- layouts/partials/article-meta/basic.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/layouts/partials/article-meta/basic.html b/layouts/partials/article-meta/basic.html index 307ca0a3..624d8386 100644 --- a/layouts/partials/article-meta/basic.html +++ b/layouts/partials/article-meta/basic.html @@ -12,9 +12,19 @@ {{ $meta := newScratch }} {{/* 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) }} - {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} -{{else if and (eq $scope "single") (.Params.showDateOnlyInArticle | default (.Site.Params.article.showDateOnlyInArticle | default false)) }} + {{ $shouldShowDate = true }} +{{ else }} + {{ $shouldShowDate = false }} +{{ end }} + +{{ if $shouldShowDate }} {{ $meta.Add "partials" (slice (partial "meta/date.html" .Date)) }} {{ end }}