Skip to content

Commit

Permalink
Fix .Truncated in manual summaries
Browse files Browse the repository at this point in the history
Fixes #1119
  • Loading branch information
bep committed May 10, 2015
1 parent be52eff commit bef496b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hugolib/page.go
Expand Up @@ -172,10 +172,14 @@ func (p *Page) setSummary() {
// rendered and ready in p.contentShortcodes

if bytes.Contains(p.rawContent, helpers.SummaryDivider) {
// If user defines split:
// Split, replace shortcode tokens, then render
p.Truncated = true // by definition
header := bytes.Split(p.rawContent, helpers.SummaryDivider)[0]
sections := bytes.Split(p.rawContent, helpers.SummaryDivider)
header := sections[0]
p.Truncated = true
if len(sections[1]) < 20 {
// only whitespace?
p.Truncated = len(bytes.Trim(sections[1], " \n\r")) > 0
}

renderedHeader := p.renderBytes(header)
if len(p.contentShortCodes) > 0 {
tmpContentWithTokensReplaced, err :=
Expand Down

0 comments on commit bef496b

Please sign in to comment.