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