mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00: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:
		@@ -169,7 +169,7 @@ func (p *Page) setSummary() {
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// If hugo defines split:
 | 
							// If hugo defines split:
 | 
				
			||||||
		// render, strip html, then 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.Summary = helpers.BytesToHTML([]byte(helpers.TruncateWordsToWholeSentence(plain, helpers.SummaryLength)))
 | 
				
			||||||
		p.Truncated = len(p.Summary) != len(plain)
 | 
							p.Truncated = len(p.Summary) != len(plain)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user