summaryrefslogtreecommitdiffstats
path: root/hugolib/page_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/page_test.go')
-rw-r--r--hugolib/page_test.go90
1 files changed, 90 insertions, 0 deletions
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 0fec397e0..d4185531b 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1968,3 +1968,93 @@ Title: {{ .Title }}
"deprecated: path in front matter was deprecated",
)
}
+
+// Issue 13538
+func TestHomePageIsLeafBundle(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+defaultContentLanguage = 'de'
+defaultContentLanguageInSubdir = true
+[languages.de]
+weight = 1
+[languages.en]
+weight = 2
+-- layouts/all.html --
+{{ .Title }}
+-- content/index.de.md --
+---
+title: home de
+---
+-- content/index.en.org --
+---
+title: home en
+---
+`
+
+ b := Test(t, files, TestOptWarn())
+
+ b.AssertFileContent("public/de/index.html", "home de")
+ b.AssertFileContent("public/en/index.html", "home en")
+ b.AssertLogContains("Using index.de.md in your content's root directory is usually incorrect for your home page. You should use _index.de.md instead.")
+ b.AssertLogContains("Using index.en.org in your content's root directory is usually incorrect for your home page. You should use _index.en.org instead.")
+}
+
+// Issue 13826
+func TestTemplateSelectionIssue13826(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+-- content/p1.md --
+---
+title: p1 (type implicitly set to page)
+---
+-- content/p2.md --
+---
+title: p2 (type explicitly set to page)
+type: page
+---
+-- content/p3.md --
+---
+title: p3 (type explicitly set to foo)
+type: foo
+---
+-- content/foo/p4.md --
+---
+title: p4 (type implicitly set to foo)
+---
+-- content/bar/p5.md --
+---
+title: p5 (type explicitly set to foo)
+type: foo
+---
+-- layouts/page/page.html --
+layouts/page/page.html
+-- layouts/foo/page.html --
+layouts/foo/page.html
+-- layouts/page.html --
+layouts/page.html
+`
+
+ b := Test(t, files)
+
+ b.AssertFileContent("public/p1/index.html", "layouts/page/page.html")
+ b.AssertFileContent("public/p2/index.html", "layouts/page/page.html")
+ b.AssertFileContent("public/p3/index.html", "layouts/foo/page.html")
+ b.AssertFileContent("public/foo/p4/index.html", "layouts/foo/page.html")
+ b.AssertFileContent("public/bar/p5/index.html", "layouts/foo/page.html")
+
+ files = strings.ReplaceAll(files, "-- layouts/page/page.html --", "-- delete-me-1.txt --")
+ files = strings.ReplaceAll(files, "-- layouts/foo/page.html --", "-- delete-me-2.txt --")
+
+ b = Test(t, files)
+
+ b.AssertFileContent("public/p1/index.html", "layouts/page.html")
+ b.AssertFileContent("public/p2/index.html", "layouts/page.html")
+ b.AssertFileContent("public/p3/index.html", "layouts/page.html")
+ b.AssertFileContent("public/foo/p4/index.html", "layouts/page.html")
+ b.AssertFileContent("public/bar/p5/index.html", "layouts/page.html")
+}