mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
hugolib: Fix Pages reinitialization on rebuilds
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page. Fixes #5833
This commit is contained in:
@@ -52,13 +52,16 @@ Content.
|
||||
|
||||
b.WithTemplatesAdded("index.html", `
|
||||
{{ range (.Paginate .Site.RegularPages).Pages }}
|
||||
* Page: {{ .Title }}|Summary: {{ .Summary }}|Content: {{ .Content }}
|
||||
* Page Paginate: {{ .Title }}|Summary: {{ .Summary }}|Content: {{ .Content }}
|
||||
{{ end }}
|
||||
{{ range .Pages }}
|
||||
* Page Pages: {{ .Title }}|Summary: {{ .Summary }}|Content: {{ .Content }}
|
||||
{{ end }}
|
||||
`)
|
||||
|
||||
b.Running().Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/index.html", "* Page: Page 1|Summary: Initial summary|Content: <p>Content.</p>")
|
||||
b.AssertFileContent("public/index.html", "* Page Paginate: Page 1|Summary: Initial summary|Content: <p>Content.</p>")
|
||||
|
||||
b.EditFiles(contentFilename, `
|
||||
---
|
||||
@@ -72,6 +75,9 @@ Edited content.
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/index.html", "* Page: Page 1 edit|Summary: Edited summary|Content: <p>Edited content.</p>")
|
||||
b.AssertFileContent("public/index.html", "* Page Paginate: Page 1 edit|Summary: Edited summary|Content: <p>Edited content.</p>")
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/5833
|
||||
b.AssertFileContent("public/index.html", "* Page Pages: Page 1 edit|Summary: Edited summary|Content: <p>Edited content.</p>")
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user