diff options
author | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2020-04-24 17:55:56 +0300 |
---|---|---|
committer | amazingrise <8315221+AmazingRise@users.noreply.github.com> | 2020-04-24 17:55:56 +0300 |
commit | a21a3b2f7bbd3631f5ac09c0114be0c5b8bcd44b (patch) | |
tree | 603d8a6d9fd3a61b214fc562a6d95e5ac5a43e45 /layouts | |
parent | ac4c8941683e11eec6252143f7994195a85bddf1 (diff) |
Add reading time.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 14f7cd1..451cf78 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -37,6 +37,16 @@ {{ end }} {{ end }} + {{ if .Site.Params.enableReadingTime }} + <i class="material-icons" style="">schedule</i> + {{ $readTime := mul (div (countwords .Content) 220.0) 60 }} + + {{ $minutes := math.Floor (div $readTime 60) }} + {{ $seconds := mod $readTime 60 }} + + {{ $minutes }} {{ cond (eq $minutes 1) "minute" "min" }} + {{ $seconds }} {{ cond (eq $seconds 1) "second" "s" }}. + {{ end }} </div> </div> </div> |