Add option to display word count

This commit is contained in:
Michael Romero 2018-11-01 01:39:04 -07:00
parent 36d7231cad
commit 1dcccecb26
2 changed files with 14 additions and 3 deletions

View File

@ -23,6 +23,7 @@ pygmentsCodefencesGuessSyntax = true
rss = true
comments = true
readingTime = true
wordCount = true
useHLJS = true
socialShare = true
delayDisqus = true

View File

@ -6,11 +6,21 @@
 {{ $lastmodstr | i18n "lastModified" }}
{{ end }}
{{ if .Site.Params.readingTime }}
 | 
<i class="fa fa-clock-o"></i>{{ i18n "readingTime"}} {{ .ReadingTime }} {{ i18n "readTime" }} ({{ .WordCount }} {{ i18n "words" }})
&nbsp;|&nbsp;
<i class="fa fa-clock-o"></i>&nbsp;
{{ i18n "readingTime"}} {{ .ReadingTime }} {{ i18n "readTime" }}
{{ end }}
{{ if .Site.Params.wordCount }}
&nbsp;|&nbsp;
<i class="fa fa-book"></i> {{ .WordCount }} {{ i18n "words" }}
{{ end }}
{{ if .Params.author }}
&nbsp;|&nbsp;
<i class="fa fa-user"></i>
{{ .Params.author | safeHTML }}
{{ end }}
{{- if .Site.Params.staticman -}}
&nbsp;|&nbsp; <i class="fa fa-comment-o"></i>
&nbsp;|&nbsp;<i class="fa fa-comment-o"></i>&nbsp;
{{ $slug := replace .URL "/" "" }}
{{ if .Site.Data.comments }}
{{ $comments := index $.Site.Data.comments $slug }}