mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
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:
parent
a17c290a33
commit
02da49597d
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue