mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Fix Truncate
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide. Fixes #880
This commit is contained in:
@@ -190,10 +190,9 @@ func (p *Page) setSummary() {
|
||||
} else {
|
||||
// If hugo defines split:
|
||||
// render, strip html, then split
|
||||
p.Summary = helpers.BytesToHTML([]byte(helpers.TruncateWordsToWholeSentence(p.PlainWords(), helpers.SummaryLength)))
|
||||
|
||||
// todo bep - check if the Plain() can be trimmed earlier
|
||||
p.Truncated = len(p.Summary) != len(strings.Trim(p.Plain(), "\n\r "))
|
||||
summary, truncated := helpers.TruncateWordsToWholeSentence(p.PlainWords(), helpers.SummaryLength)
|
||||
p.Summary = helpers.BytesToHTML([]byte(summary))
|
||||
p.Truncated = truncated
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user