mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Fix .WordCount, .FuzzyWordCount, .ReadingTime when summary marker is set
This bug was introduced in Hugo 0.40. It is when you use the `<!--more-->` summary marker. Note that this affects the word stats only. The related `PlainWords`, `Plain`, `Content` all return correct values. Fixes #4675 Fixes #4682
This commit is contained in:
parent
391f59f996
commit
001a28c2f9
3 changed files with 114 additions and 5 deletions
|
@ -493,7 +493,10 @@ func totalWordsOld(s string) int {
|
|||
}
|
||||
|
||||
// TruncateWordsByRune truncates words by runes.
|
||||
func (c *ContentSpec) TruncateWordsByRune(words []string) (string, bool) {
|
||||
func (c *ContentSpec) TruncateWordsByRune(in []string) (string, bool) {
|
||||
words := make([]string, len(in))
|
||||
copy(words, in)
|
||||
|
||||
count := 0
|
||||
for index, word := range words {
|
||||
if count >= c.summaryLength {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue