Add word count
This commit is contained in:
@@ -222,6 +222,7 @@ disable_sections = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
|
||||
# Navigation
|
||||
edit_url = "" # Example: "https://github.com/account/project/edit/master/content/%s"
|
||||
@@ -309,6 +310,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_summary = false
|
||||
disable_title = false
|
||||
disable_word_count = false
|
||||
```
|
||||
|
||||
The parameter object is accessed in site parameters as `[params.paige]`, and in page parameters as `[paige]`.
|
||||
@@ -1087,6 +1089,8 @@ Page identifiers:
|
||||
<dd>The page title.</dd>
|
||||
<dt><code>#paige-page-toc</code></dt>
|
||||
<dd>The page table of contents.</dd>
|
||||
<dt><code>#paige-page-word-count</code></dt>
|
||||
<dd>The page word count.</dd>
|
||||
</dl>
|
||||
|
||||
Site identifiers:
|
||||
@@ -1146,6 +1150,8 @@ Subpage classes:
|
||||
<dd>The summary.</dd>
|
||||
<dt><code>.paige-title</code></dt>
|
||||
<dd>The title.</dd>
|
||||
<dt><code>.paige-page-word-count</code></dt>
|
||||
<dd>The word count.</dd>
|
||||
</dl>
|
||||
|
||||
Page kind classes:
|
||||
@@ -1217,6 +1223,7 @@ disable_keywords = true
|
||||
disable_reading_time = true
|
||||
disable_series = true
|
||||
disable_summary = true
|
||||
disable_word_count = true
|
||||
|
||||
[params.paige.pages]
|
||||
disable_authors = true
|
||||
@@ -1227,6 +1234,7 @@ disable_prev = true
|
||||
disable_reading_time = true
|
||||
disable_series = true
|
||||
disable_toc = true
|
||||
disable_word_count = true
|
||||
```
|
||||
|
||||
### Narrow look
|
||||
|
@@ -19,6 +19,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
[paige.pages.base_schema]
|
||||
isAccessibleForFree = true
|
||||
isFamilyFriendly = true
|
||||
@@ -69,6 +70,7 @@ disable_keywords = false
|
||||
disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_summary = false
|
||||
disable_word_count = false
|
||||
+++
|
||||
|
||||
This site hides some section page data by default. This page shows it all.
|
||||
@@ -95,6 +97,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
|
||||
[paige.pages.base_schema]
|
||||
|
||||
@@ -163,4 +166,5 @@ disable_keywords = false
|
||||
disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_summary = false
|
||||
disable_word_count = false
|
||||
```
|
||||
|
@@ -20,6 +20,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
[paige.pages.base_schema]
|
||||
isAccessibleForFree = true
|
||||
isFamilyFriendly = true
|
||||
@@ -89,6 +90,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
|
||||
[paige.pages.base_schema]
|
||||
|
||||
|
@@ -44,6 +44,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
[paige.pages.base_schema]
|
||||
isAccessibleForFree = true
|
||||
isFamilyFriendly = true
|
||||
@@ -139,6 +140,7 @@ disable_reading_time = false
|
||||
disable_series = false
|
||||
disable_title = false
|
||||
disable_toc = false
|
||||
disable_word_count = false
|
||||
|
||||
[paige.pages.base_schema]
|
||||
|
||||
|
@@ -55,6 +55,7 @@ disable_prev = true
|
||||
disable_reading_time = true
|
||||
disable_series = true
|
||||
disable_toc = true
|
||||
disable_word_count = true
|
||||
|
||||
[paige.pages.base_schema]
|
||||
isAccessibleForFree = true
|
||||
@@ -71,6 +72,7 @@ disable_keywords = true
|
||||
disable_reading_time = true
|
||||
disable_series = true
|
||||
disable_summary = true
|
||||
disable_word_count = true
|
||||
|
||||
[taxonomies]
|
||||
author = "authors"
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: الأقسام
|
||||
|
||||
paige_words:
|
||||
one: كلمة
|
||||
other: كلمات
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: বিভাগ
|
||||
|
||||
paige_words:
|
||||
one: শব্দ
|
||||
other: শব্দগুলি
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Abschnitte
|
||||
|
||||
paige_words:
|
||||
one: Wort
|
||||
other: Wörter
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Sections
|
||||
|
||||
paige_words:
|
||||
one: word
|
||||
other: words
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Secciones
|
||||
|
||||
paige_words:
|
||||
one: palabra
|
||||
other: palabras
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Sections
|
||||
|
||||
paige_words:
|
||||
one: mot
|
||||
other: mots
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: अनुभाग
|
||||
|
||||
paige_words:
|
||||
one: शब्द
|
||||
other: शब्दों
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: セクション
|
||||
|
||||
paige_words:
|
||||
one: 単語
|
||||
other: 単語
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: विभागे
|
||||
|
||||
paige_words:
|
||||
one: शब्द
|
||||
other: शब्द
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: سیکشنز
|
||||
|
||||
paige_words:
|
||||
one: لفظ
|
||||
other: الفاظ
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Seções
|
||||
|
||||
paige_words:
|
||||
one: palavra
|
||||
other: palavras
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: Разделы
|
||||
|
||||
paige_words:
|
||||
one: слово
|
||||
other: слова
|
||||
|
@@ -67,3 +67,7 @@ paige_search_something:
|
||||
|
||||
paige_sections:
|
||||
other: 部分
|
||||
|
||||
paige_words:
|
||||
one: 词
|
||||
other: 词
|
||||
|
@@ -17,6 +17,7 @@
|
||||
{{ $tags := $page.GetTerms "tags" }}
|
||||
{{ $time := $page.ReadingTime | and ($page.Parent.Param "paige.subpages.disable_reading_time" | not) }}
|
||||
{{ $title := $page.LinkTitle | markdownify | plainify | htmlUnescape | and ($page.Parent.Param "paige.subpages.disable_title" | not) }}
|
||||
{{ $words := $page.WordCount | and ($page.Parent.Param "paige.subpages.disable_word_count" | not) }}
|
||||
|
||||
{{ if $draft }}
|
||||
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
|
||||
@@ -104,6 +105,10 @@
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $words }}
|
||||
<p class="paige-page-word-count paige-row-short text-center text-secondary">{{ . }} {{ i18n "paige_words" . }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $time }}
|
||||
<p class="paige-page-reading-time paige-row-short text-center text-secondary">{{ . }} {{ i18n "paige_minutes" . }}</p>
|
||||
{{ end }}
|
||||
|
@@ -16,10 +16,11 @@
|
||||
{{ $time := $page.ReadingTime | and ($page.Param "paige.pages.disable_reading_time" | not) }}
|
||||
{{ $title := $page.LinkTitle | markdownify | and ($page.Param "paige.pages.disable_title" | not) }}
|
||||
{{ $toc := and $page.Content (ne $page.TableOfContents `<nav id="TableOfContents"></nav>`) | and ($page.Param "paige.pages.disable_toc" | not) }}
|
||||
{{ $words := $page.WordCount | and ($page.Param "paige.pages.disable_word_count" | not) }}
|
||||
|
||||
{{ $keywords := sort (append $categories $tags) "LinkTitle" | and ($page.Param "paige.pages.disable_keywords" | not) }}
|
||||
|
||||
{{ if or $alert $authors $date $description $first $keywords $last $time $series $title $toc }}
|
||||
{{ if or $alert $authors $date $description $first $keywords $last $time $series $title $toc $words }}
|
||||
<header class="mw-100" id="paige-page-header">
|
||||
<div class="align-items-center d-flex flex-column">
|
||||
{{ partial "paige/func-include.html" (dict "name" "page-header-first%s.html" "page" $page) }}
|
||||
@@ -84,6 +85,10 @@
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $words }}
|
||||
<p class="paige-row-short text-center text-secondary" id="paige-page-word-count" {{ if $microdata }} itemprop="wordCount" {{ end }}>{{ . }} {{ i18n "paige_words" . }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $time }}
|
||||
<p class="paige-row-short text-center text-secondary" id="paige-page-reading-time" {{ if $microdata }} itemprop="timeRequired" {{ end }}>{{ . }} {{ i18n "paige_minutes" . }}</p>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user