aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-word-count.html
blob: 1c44c78cdac7b7aa154ed77c01f5a739d096e2bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<micro-metadata-wordcount>
  {{- $author    := index .Site.Data ((or .Params.author .Site.Author.default.user) | default "default") -}}
  {{- $limit     := $author.wordlimit -}}
  {{- $wordLimit := gt  .WordCount $limit -}}
  {{- $overLimit := sub .WordCount $limit -}}
  {{- safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/file-text.svg")) -}}

  <word-limit title="{{- if $wordLimit -}} {{ $overLimit }} words over the limit {{- else -}} {{ .WordCount }} words {{- end -}}">
    <word-count>
      {{- if $wordLimit -}}
        <em>{{ .WordCount }}</em>
      {{- else -}}
        {{ .WordCount }}
      {{- end -}}
      /{{ $limit }} words
{{- /* This comment removes trailing newlines and white spaces. */ -}}
    </word-count>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
  </word-limit>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
</micro-metadata-wordcount>
{{- /* This comment removes trailing newlines and white spaces. */ -}}