Skip to content

Commit

Permalink
Merge reading time.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmazingRise committed May 8, 2020
2 parents ae16927 + a21a3b2 commit 68e14e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 68e14e3

Please sign in to comment.