From 001a28c2f9ed121b33df18fe792859ab378784c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 27 Apr 2018 10:17:01 +0200 Subject: Fix .WordCount, .FuzzyWordCount, .ReadingTime when summary marker is set This bug was introduced in Hugo 0.40. It is when you use the `` summary marker. Note that this affects the word stats only. The related `PlainWords`, `Plain`, `Content` all return correct values. Fixes #4675 Fixes #4682 --- helpers/content.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'helpers') 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 { -- cgit v1.2.3