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.
This commit is contained in:
Anthony Fok 2015-01-20 15:50:32 -07:00
parent a17c290a33
commit 02da49597d

View file

@ -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)
}