aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-word-count.html
blob: e88fec63b9af34fd9fb3802736ccad51c3801970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<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 -}}
  {{- $bitCount  := lang.FormatNumberCustom 0 (len .Content) -}}
  {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/file-text.svg")) -}}

  <word-limit
title="
{{- if $wordLimit -}}
  {{ $overLimit }} words over the limit
 {{- else -}}
  {{ .WordCount }} words
{{- end }}
{{ $bitCount }} bits
">
    <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. */ -}}