diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-27 10:17:01 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-04-29 10:58:58 +0200 |
commit | 001a28c2f9ed121b33df18fe792859ab378784c6 (patch) | |
tree | c6ba82a96cbf697b6ec99a220c0e477529b10f51 /helpers | |
parent | 391f59f996bee265ac4448103bd2739d4f397439 (diff) |
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
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/content.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/helpers/content.go b/helpers/content.go index f12a55ba8..d42995519 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -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 { |