diff options
author | Anthony Fok <foka@debian.org> | 2015-01-21 01:50:32 +0300 |
---|---|---|
committer | Anthony Fok <foka@debian.org> | 2015-01-21 01:50:32 +0300 |
commit | 02da49597dce2e8206495eb3f778b22126ca6724 (patch) | |
tree | cbebc3a8929ed3f0725280e206e1a40409b4b2c2 | |
parent | a17c290a33bd44fd058f44c994893df892f783f6 (diff) |
Fix string comparison for .Truncated page variable
Instead of `strings.TrimSpace()`, use `strings.Join(strings.Fields(s), " ")`
to collapse all whitespaces into single spaces, in order to match the
behaviour of helpers.TruncateWordsToWholeSentence(),
in order to detect non-truncated content correctly.
-rw-r--r-- | hugolib/page.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index 1383f387e..479aa1398 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -169,7 +169,7 @@ func (p *Page) setSummary() { } else { // If hugo defines split: // render, strip html, then split - plain := strings.TrimSpace(p.Plain()) + plain := strings.Join(strings.Fields(p.Plain()), " ") p.Summary = helpers.BytesToHTML([]byte(helpers.TruncateWordsToWholeSentence(plain, helpers.SummaryLength))) p.Truncated = len(p.Summary) != len(plain) } |