feat(article): reading time (#204)
* add reading time feature * Revert change in jsconfig.json * feat: add article.readingTime param, and improve style * Revert change in jsconfig.json x2 * Remove reading time in compact layout It doesn't look right to me for now * feat: add i18n support to reading time string * Hide footer.article-time when there's not content Co-authored-by: Jimmy Cai <github@jimmycai.com>
This commit is contained in:
co-authored by
Jimmy Cai
parent
a25e6463bd
commit
dcfc7b5589
@@ -21,12 +21,25 @@
|
||||
</h3>
|
||||
{{ end }}
|
||||
|
||||
{{- if not .Date.IsZero -}}
|
||||
{{ if or (not .Date.IsZero) (.Site.Params.article.readingTime) }}
|
||||
<footer class="article-time">
|
||||
{{ partial "helper/icon" "clock" }}
|
||||
<time class="article-time--published">
|
||||
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
|
||||
</time>
|
||||
{{ if not .Date.IsZero }}
|
||||
<div>
|
||||
{{ partial "helper/icon" "date" }}
|
||||
<time class="article-time--published">
|
||||
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
|
||||
</time>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.article.readingTime }}
|
||||
<div>
|
||||
{{ partial "helper/icon" "clock" }}
|
||||
<time class="article-time--reading">
|
||||
{{ T "article.readingTime" .ReadingTime }}
|
||||
</time>
|
||||
</div>
|
||||
{{ end }}
|
||||
</footer>
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
Reference in New Issue
Block a user