Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix headless regression #6558

Merged
merged 1 commit into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions hugolib/pagebundler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,43 @@ HEADLESS {{< myShort >}}

}

func TestPageBundlerHeadlessIssue6552(t *testing.T) {
t.Parallel()

b := newTestSitesBuilder(t)
b.WithContent("headless/h1/index.md", `
---
title: My Headless Bundle1
headless: true
---
`, "headless/h1/p1.md", `
---
title: P1
---
`, "headless/h2/index.md", `
---
title: My Headless Bundle2
headless: true
---
`)

b.WithTemplatesAdded("index.html", `
{{ $headless1 := .Site.GetPage "headless/h1" }}
{{ $headless2 := .Site.GetPage "headless/h2" }}

HEADLESS1: {{ $headless1.Title }}|{{ $headless1.RelPermalink }}|{{ len $headless1.Resources }}|
HEADLESS2: {{ $headless2.Title }}{{ $headless2.RelPermalink }}|{{ len $headless2.Resources }}|

`)

b.Build(BuildCfg{})

b.AssertFileContent("public/index.html", `
HEADLESS1: My Headless Bundle1||1|
HEADLESS2: My Headless Bundle2|0|
`)
}

func TestMultiSiteBundles(t *testing.T) {
c := qt.New(t)
b := newTestSitesBuilder(t)
Expand Down
2 changes: 1 addition & 1 deletion hugolib/pages_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ type pagesMapBucket struct {
}

func (b *pagesMapBucket) isEmpty() bool {
return len(b.pages) == 0 && len(b.bucketSections) == 0
return len(b.pages) == 0 && len(b.headlessPages) == 0 && len(b.bucketSections) == 0
}

func (b *pagesMapBucket) getPages() page.Pages {
Expand Down