aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-06-01 10:27:10 +0200
committerBjørn Erik Pedersen <[email protected]>2024-06-01 12:04:05 +0200
commit0221ddb39ee5d49387a779bc83af464e42fb3ebe (patch)
tree33ff51d4a795e396189b4bd3c2654427bf279b81 /hugolib
parent74b9b8a2297852f37be55d4e12acb79de492707b (diff)
downloadhugo-0221ddb39ee5d49387a779bc83af464e42fb3ebe.tar.gz
hugo-0221ddb39ee5d49387a779bc83af464e42fb3ebe.zip
content adapter: Handle <!--more--> separator in content.value
Closes #12556
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page__per_output.go5
-rw-r--r--hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go26
2 files changed, 30 insertions, 1 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index 5b039b91b..6dffd18a5 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -307,7 +307,10 @@ func (pco *pageContentOutput) RenderString(ctx context.Context, args ...any) (te
if pageparser.HasShortcode(contentToRender) {
contentToRenderb := []byte(contentToRender)
// String contains a shortcode.
- parseInfo.itemsStep1, err = pageparser.ParseBytesMain(contentToRenderb, pageparser.Config{})
+ parseInfo.itemsStep1, err = pageparser.ParseBytes(contentToRenderb, pageparser.Config{
+ NoFrontMatter: true,
+ NoSummaryDivider: true,
+ })
if err != nil {
return "", err
}
diff --git a/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go b/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go
index cbb2da75c..f351cbb98 100644
--- a/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go
+++ b/hugolib/pagesfromdata/pagesfromgotmpl_integration_test.go
@@ -643,3 +643,29 @@ Footer: {{ range index site.Menus.footer }}{{ .Name }}|{{ end }}|
"Footer: Footer|p2||",
)
}
+
+func TestPagesFromGoTmplMore(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+[markup.goldmark.renderer]
+unsafe = true
+-- content/s1/_content.gotmpl --
+{{ $page := dict
+ "content" (dict "mediaType" "text/markdown" "value" "aaa <!--more--> bbb")
+ "title" "p1"
+ "path" "p1"
+ }}
+ {{ .AddPage $page }}
+-- layouts/_default/single.html --
+summary: {{ .Summary }}|content: {{ .Content}}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileContent("public/s1/p1/index.html",
+ "<p>aaa</p>|content: <p>aaa</p>\n<p>bbb</p>",
+ )
+}