summaryrefslogtreecommitdiffstats
path: root/hugolib/config_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-07-07 18:41:10 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-07-08 16:08:46 +0200
commit92e86702eab5d68cd4eda87069fba906139f5c08 (patch)
tree6edb31f509cb321b3ab9d038bfd6d50ea07f6fac /hugolib/config_test.go
parent6c9ea022a9022a281031eed75ceb00c4c03f2b5a (diff)
Fix defaultContentLanguageInSubdir with only 1 language
Fixes #10064
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r--hugolib/config_test.go91
1 files changed, 91 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index f87d8b936..c4a373232 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -1295,3 +1295,94 @@ Home.
b.Assert(b.H.Configs.LanguageConfigSlice[0].Module.Mounts, qt.HasLen, 7)
}
+
+func TestDefaultContentLanguageInSubdirOnlyOneLanguage(t *testing.T) {
+
+ t.Run("One language, default in sub dir", func(t *testing.T) {
+ t.Skip()
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+defaultContentLanguage = "en"
+defaultContentLanguageInSubdir = true
+disableKinds = ["taxonomy", "term", "page", "section"]
+-- content/foo/bar.txt --
+Foo.
+-- layouts/index.html --
+Home.
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/en/index.html", "Home.")
+ b.AssertFileContent("public/en/foo/bar.txt", "Foo.")
+ })
+
+ t.Run("Two languages, default in sub dir", func(t *testing.T) {
+ t.Skip()
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+defaultContentLanguage = "en"
+defaultContentLanguageInSubdir = true
+disableKinds = ["taxonomy", "term", "page", "section"]
+[languages]
+[languages.en]
+title = "English Title"
+[languages.sv]
+title = "Swedish Title"
+-- content/foo/bar.txt --
+Foo.
+-- layouts/index.html --
+Home.
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/en/index.html", "Home.")
+ b.AssertFileContent("public/en/foo/bar.txt", "Foo.")
+ })
+
+ t.Run("Two languages, default in root", func(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+defaultContentLanguage = "en"
+defaultContentLanguageInSubdir = false
+disableKinds = ["taxonomy", "term", "page", "section"]
+[languages]
+[languages.en]
+title = "English Title"
+[languages.sv]
+title = "Swedish Title"
+-- content/foo/bar.txt --
+Foo.
+-- layouts/index.html --
+Home.
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/index.html", "Home.")
+ b.AssertFileContent("public/foo/bar.txt", "Foo.")
+ })
+
+}