aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-09-04 19:07:59 +0200
committerBjørn Erik Pedersen <[email protected]>2024-09-05 12:12:24 +0200
commit8f2eac0195cf02f7edbcbce4b7e02768b12762fe (patch)
tree703f71598e0e4bc18d9e584e2f7f76dfe32abb5e /hugolib
parentb570a5f1184fe275ad6fc04b82050ad8fce95651 (diff)
downloadhugo-8f2eac0195cf02f7edbcbce4b7e02768b12762fe.tar.gz
hugo-8f2eac0195cf02f7edbcbce4b7e02768b12762fe.zip
Make ContentWithoutSummary return Content when summary is fetched from front matter
Fixes #12822
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page__content.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/hugolib/page__content.go b/hugolib/page__content.go
index cc93fe5d5..4ec91f7b5 100644
--- a/hugolib/page__content.go
+++ b/hugolib/page__content.go
@@ -504,7 +504,7 @@ type contentTableOfContents struct {
}
type contentSummary struct {
- content string
+ content template.HTML
contentWithoutSummary template.HTML
summary page.Summary
}
@@ -612,9 +612,9 @@ func (c *cachedContentScope) contentRendered(ctx context.Context) (contentSummar
Truncated: summarized.Truncated(),
}
result.contentWithoutSummary = template.HTML(summarized.ContentWithoutSummary())
- result.content = summarized.Content()
+ result.content = template.HTML(summarized.Content())
} else {
- result.content = string(b)
+ result.content = template.HTML(string(b))
}
if !c.pi.hasSummaryDivider && cp.po.p.m.pageConfig.Summary == "" {
@@ -646,6 +646,7 @@ func (c *cachedContentScope) contentRendered(ctx context.Context) (contentSummar
Text: helpers.BytesToHTML(html),
Type: page.SummaryTypeFrontMatter,
}
+ rs.Value.contentWithoutSummary = rs.Value.content
}
return rs, err
@@ -879,7 +880,7 @@ func (c *cachedContentScope) Content(ctx context.Context) (template.HTML, error)
if err != nil {
return "", err
}
- return template.HTML(cr.content), nil
+ return cr.content, nil
}
func (c *cachedContentScope) ContentWithoutSummary(ctx context.Context) (template.HTML, error) {