diff --git a/config/_default/params.toml b/config/_default/params.toml index 875dc423..4d693ddb 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -30,6 +30,7 @@ colorScheme = "congo" showPagination = true showReadingTime = true # sharingLinks = ["facebook", "twitter", "pinterest", "reddit", "linkedin", "email"] + showWordCount = true [list] showBreadcrumbs = false diff --git a/i18n/de.yaml b/i18n/de.yaml index 7cdc20e3..631707bd 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -6,6 +6,9 @@ article: one: "{{ .Count }} min" other: "{{ .Count }} min" reading_time_title: "Lesezeit" + # word_count: + # one: "{{ .Count }} word" + # other: "{{ .Count }} words" author: byline_title: "Autor" diff --git a/i18n/en.yaml b/i18n/en.yaml index 1c539b3b..6cb5c3d5 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -6,6 +6,9 @@ article: one: "{{ .Count }} min" other: "{{ .Count }} mins" reading_time_title: "Reading time" + word_count: + one: "{{ .Count }} word" + other: "{{ .Count }} words" author: byline_title: "Author" diff --git a/i18n/es.yaml b/i18n/es.yaml index 4a7df79b..c8afbc09 100644 --- a/i18n/es.yaml +++ b/i18n/es.yaml @@ -6,6 +6,9 @@ article: one: "{{ .Count }} min" other: "{{ .Count }} mins" reading_time_title: "Tiempo de lectura" + # word_count: + # one: "{{ .Count }} word" + # other: "{{ .Count }} words" author: byline_title: "Autor" diff --git a/i18n/fr.yaml b/i18n/fr.yaml index bfe438fd..b3078535 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -6,6 +6,9 @@ article: one: "{{ .Count }} min" other: "{{ .Count }} mins" reading_time_title: "Temps de lecture" + # word_count: + # one: "{{ .Count }} word" + # other: "{{ .Count }} words" author: byline_title: "Auteur" diff --git a/i18n/pt-BR.yaml b/i18n/pt-BR.yaml index 6e5b7d2f..2396bc7b 100644 --- a/i18n/pt-BR.yaml +++ b/i18n/pt-BR.yaml @@ -6,6 +6,9 @@ article: one: "{{ .Count }} minuto" other: "{{ .Count }} minutos" reading_time_title: "Tempo de leitura" + # word_count: + # one: "{{ .Count }} word" + # other: "{{ .Count }} words" author: byline_title: "Autor" diff --git a/i18n/zh.yaml b/i18n/zh.yaml index 175208a0..ec93aa7e 100644 --- a/i18n/zh.yaml +++ b/i18n/zh.yaml @@ -5,6 +5,9 @@ article: reading_time: other: "{{ .Count }} 分钟" reading_time_title: "预计阅读" + word_count: + one: "{{ .Count }} 字" + other: "{{ .Count }} 字" author: byline_title: "作者" diff --git a/layouts/partials/article-meta.html b/layouts/partials/article-meta.html index e2118119..c0e2a8f3 100644 --- a/layouts/partials/article-meta.html +++ b/layouts/partials/article-meta.html @@ -16,6 +16,10 @@ {{ $meta.Add "partials" (slice (partial "meta/date.html" .)) }} {{ end }} + {{ if and (.Params.showWordCount | default (.Site.Params.article.showWordCount | default true)) (ne .WordCount 0) }} + {{ $meta.Add "partials" (slice (partial "meta/word-count.html" .)) }} + {{ end }} + {{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }} {{ $meta.Add "partials" (slice (partial "meta/reading-time.html" .)) }} {{ end }} diff --git a/layouts/partials/meta/word-count.html b/layouts/partials/meta/word-count.html new file mode 100644 index 00000000..e68ec0d6 --- /dev/null +++ b/layouts/partials/meta/word-count.html @@ -0,0 +1,5 @@ + + {{- i18n "article.word_count" .WordCount | emojify -}} + +{{- /* Trim EOF */ -}} + \ No newline at end of file