mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-02-06 11:53:31 +08:00
fix: reading time in zh-cn
This commit is contained in:
parent
087989e427
commit
83d60dbfc1
@ -39,9 +39,15 @@
|
||||
|
||||
{{ if $showReadingTime }}
|
||||
<div>
|
||||
{{ $readingTime := .ReadingTime }}
|
||||
{{ if eq .Site.Language.LanguageCode "zh-cn"}}
|
||||
{{ $wordsPerMinute := 500 }}
|
||||
{{ $charCount := .Content | replaceRE "[\\pP]" "" | countrunes}}
|
||||
{{ $readingTime = div (float $charCount) $wordsPerMinute | math.Ceil | int }}
|
||||
{{ end }}
|
||||
{{ partial "helper/icon" "clock" }}
|
||||
<time class="article-time--reading">
|
||||
{{ T "article.readingTime" .ReadingTime }}
|
||||
{{ T "article.readingTime" $readingTime }}
|
||||
</time>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user