Skip to content

Commit

Permalink
Add option to add word count to metadata (#740)
Browse files Browse the repository at this point in the history
Usage: 
ShowWordCount: true
  • Loading branch information
thiagowfx committed Jan 21, 2022
1 parent 37f359e commit b0ab8ea
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions i18n/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one: "1 Minute"
other: "{{ .Count }} Minuten"

- id: words
translation:
one : "Wort"
other: "{{ .Count }} Wörter"

- id: toc
translation: "Inhaltsverzeichnis"

Expand Down
5 changes: 5 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one : "1 min"
other: "{{ .Count }} min"

- id: words
translation:
one : "word"
other: "{{ .Count }} words"

- id: toc
translation: "Table of Contents"

Expand Down
7 changes: 6 additions & 1 deletion i18n/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one : "1 min"
other: "{{ .Count }} min"

- id: words
translation:
one : "palabra"
other: "{{ .Count }} palabras"

- id: toc
translation: "Tabla de Contenidos"

Expand All @@ -25,4 +30,4 @@
translation: "copiar"

- id: code_copied
translation: "¡copiado!"
translation: "¡copiado!"
5 changes: 5 additions & 0 deletions i18n/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one : "1 min"
other: "{{ .Count }} min"

- id: words
translation:
one : "mot"
other: "{{ .Count }} mots"

- id: toc
translation: "Table des Matières"

Expand Down
5 changes: 5 additions & 0 deletions i18n/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one: "1 minuto"
other: "{{ .Count }} minuti"

- id: words
translation:
one : "parola"
other: "{{ .Count }} parole"

- id: toc
translation: "Tabella dei Contenuti"

Expand Down
5 changes: 5 additions & 0 deletions i18n/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one: "1 min"
other: "{{ .Count }} min"

- id: words
translation:
one : "woord"
other: "{{ .Count }} woorden"

- id: toc
translation: "Inhoudsopgave"

Expand Down
5 changes: 5 additions & 0 deletions i18n/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
one: "1 minuto"
other: "{{ .Count }} minutos"

- id: words
translation:
one : "palavra"
other: "{{ .Count }} palavras"

- id: toc
translation: "Conteúdo"

Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/post_meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }}
{{- end }}

{{- if (.Param "ShowWordCount") -}}
{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "%d words" .WordCount))) }}
{{- end }}

{{- with (partial "author.html" .) }}
{{- $scratch.Add "meta" (slice .) }}
{{- end }}
Expand Down

0 comments on commit b0ab8ea

Please sign in to comment.