add reading time param

This commit is contained in:
panr 2021-10-24 10:43:59 +02:00
parent bbaf93ff6f
commit 0c08f72167
8 changed files with 15 additions and 8 deletions

View File

@ -189,7 +189,7 @@ to `config.toml` file in your Hugo root directory and change params fields. In c
## Post archetype
See the basic `post` file params supported by the theme — https://github.com/panr/hugo-theme-terminal/blob/master/archetypes/posts.md
See the default `post` file params supported by the theme — https://github.com/panr/hugo-theme-terminal/blob/master/archetypes/posts.md
## Add-ons

View File

@ -8,4 +8,5 @@ tags = ["", ""]
keywords = ["", ""]
description = ""
showFullContent = false
readingTime = false
+++

View File

@ -5,11 +5,17 @@
<div class="post-meta">
{{ if .Params.Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }} {{ if $.Site.Params.showLastUpdated }}[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]{{ end }}
{{ .Date.Format "2006-01-02" }}
{{ if $.Site.Params.showLastUpdated }}
[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]
{{ end }}
</span>
{{ end }}
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>
<span class="post-author">:: {{ . }}</span>
{{ end }}
{{ if and (.Param "readingTime") (eq (.Param "readingTime") true) }}
<span class="post-reading-time">:: {{ .ReadingTime }} min read ({{ .WordCount }} words)</span>
{{ end }}
</div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long