fix(article): frontmatter field .ReadingTime should overwrite global configuration (#710)

This commit is contained in:
Jimmy Cai 2022-10-29 14:50:15 +02:00 committed by GitHub
parent 30e033c660
commit 5d34c3de44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,9 +23,12 @@
{{ end }} {{ end }}
</div> </div>
{{ if or (not .Date.IsZero) (.Site.Params.article.readingTime) }} {{ $showReadingTime := .Params.readingTime | default (.Site.Params.article.readingTime) }}
{{ $showDate := not .Date.IsZero }}
{{ $showFooter := or $showDate $showReadingTime }}
{{ if $showFooter }}
<footer class="article-time"> <footer class="article-time">
{{ if not .Date.IsZero }} {{ if $showDate }}
<div> <div>
{{ partial "helper/icon" "date" }} {{ partial "helper/icon" "date" }}
<time class="article-time--published"> <time class="article-time--published">
@ -34,7 +37,7 @@
</div> </div>
{{ end }} {{ end }}
{{ if (.Params.readingTime | default (.Site.Params.article.readingTime)) }} {{ if $showReadingTime }}
<div> <div>
{{ partial "helper/icon" "clock" }} {{ partial "helper/icon" "clock" }}
<time class="article-time--reading"> <time class="article-time--reading">