aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/word-count.html
blob: f566b079316b4fcd17e36e766d0cf6d7f52a324e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{{ $author    := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") }}
{{ $limit     := $author.wordlimit }}
{{ $wordLimit := gt  .WordCount $limit }}
{{ $overLimit := sub .WordCount $limit }}

<word-limit title="{{- if $wordLimit -}}{{ $overLimit }} words over the limit{{ else }} {{ .WordCount }} words {{ end }}">
  <word-count>
  {{- if $wordLimit -}}
    <em>{{ .WordCount }}</em>
  {{- else -}}
    {{ .WordCount }}
  {{- end -}}
  </word-count>/{{ $limit }} words
</word-limit>