mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
29.49.2025 39e2145985954eac07dd343a456f5696c8f9e9d6
theme(fix): add configurability to reading time display

see #801

Signed-off-by: Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
1 files modified
8 ■■■■ changed files
layouts/_default/single.html 8 ●●●● patch | view | raw | blame | history
layouts/_default/single.html
@@ -46,7 +46,13 @@
          3) A page front matter value is set `show_reading_time = true`
        */}}
      {{ if (or (compare.Eq (.Param "show_reading_time") true) (compare.Eq $section.Params.show_reading_time true) )}}
        <span class="f6 mv4 dib tracked"> - {{ lang.Translate "readingTime" .ReadingTime }} </span>
        {{ $readingTime := .ReadingTime }}
        {{ with .Site.Params.reading_speed }}
          {{ $readingTime = div (float $.WordCount) . }}
          {{ $readingTime = math.Ceil $readingTime }}
          {{ $readingTime = int $readingTime }}
        {{ end }}
        <span class="f6 mv4 dib tracked"> - {{ lang.Translate "readingTime" $readingTime }} </span>
        <span class="f6 mv4 dib tracked"> - {{ lang.Translate "wordCount" .WordCount }} </span>
      {{ end }}
    </header>