diff options
author | Jimmy Cai <github@jimmycai.com> | 2022-10-29 15:50:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 15:50:15 +0300 |
commit | 5d34c3de440fefd846fc3f36de991cd284b890f5 (patch) | |
tree | 2d8fc8f677bd7a669287c1c05491a5160aab8b5a | |
parent | 30e033c66019e27c482eee3361beb040360315bf (diff) |
fix(article): frontmatter field `.ReadingTime` should overwrite global configuration (#710)
-rw-r--r-- | layouts/partials/article/components/details.html | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index cb85f1c..cc0a0fc 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -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"> |