diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d5cba57..1bb52b48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. - :sparkles: Feat(SEO): add options to make output baidu_urls.txt file ([#138](https://github.com/Lruihao/FixIt/issues/138)) - :bug: Fix: Giscus comments invalid config `inputPosition` - :bug: Fix: busuanzi logic error +- :bug: Fix: close comment system logic error when the article was expired - :art: Style: add scroll bar for auto toc ([#136](https://github.com/Lruihao/FixIt/issues/136)) - :arrow_up: Chore: update some third-party libraries - **Full Changelog:** @Lruihao [`v0.2.14...v0.2.15`](https://github.com/Lruihao/FixIt/compare/v0.2.14...v0.2.15) diff --git a/layouts/partials/single/expiration-reminder.html b/layouts/partials/single/expiration-reminder.html index f0983db3..f004f3b0 100644 --- a/layouts/partials/single/expiration-reminder.html +++ b/layouts/partials/single/expiration-reminder.html @@ -13,10 +13,6 @@ {{- if gt $daysAgo $warningThreshold -}} {{- $type = "warning" -}} {{- $icon = "fa-exclamation-triangle" -}} - {{- /* If the article expires, close the comment or not */ -}} - {{- if $expirationReminder.closeComment -}} - {{- .Scratch.Set "comment" dict -}} - {{- end -}} {{- end -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 73cec96e..770d321b 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -50,6 +50,15 @@ {{- end -}}  {{ T "wordCount" .WordCount }}   {{ T "readingTime" .ReadingTime }}  + + {{- /* If the article expires, close the comment or not */ -}} + {{- $expirationReminder := $params.expirationReminder | default dict -}} + {{- if + $expirationReminder.enable + | and (gt (div (sub now.Unix .Lastmod.Unix) 86400) ($expirationReminder.warning | default 180)) + | and $expirationReminder.closeComment -}} + {{- .Scratch.Set "comment" (dict "enable" false) -}} + {{- end -}} {{- $comment := .Scratch.Get "comment" | default dict -}} {{- /* Visitor Count */ -}} {{- if $comment.enable -}}