aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/rebuild_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-16 14:24:35 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-16 19:05:18 +0100
commit68f67c9aebfeb63aa12d69e86b1d652d6ce63ce0 (patch)
treea3231ec1e542c9f44d29fcb805bb9804ea5c0bb0 /hugolib/rebuild_test.go
parent43ea2cd660a9052f45729e1a1d7dbc68c1d08440 (diff)
downloadhugo-68f67c9aebfeb63aa12d69e86b1d652d6ce63ce0.tar.gz
hugo-68f67c9aebfeb63aa12d69e86b1d652d6ce63ce0.zip
Fix rebuild regression on non-default content language edits
Fixes #12043
Diffstat (limited to 'hugolib/rebuild_test.go')
-rw-r--r--hugolib/rebuild_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go
index 06a6083f5..6e43a4570 100644
--- a/hugolib/rebuild_test.go
+++ b/hugolib/rebuild_test.go
@@ -1171,6 +1171,59 @@ Hello: {{ i18n "hello" }}
b.AssertFileContent("public/index.html", "Hello: Hugo")
}
+func TestRebuildEditContentNonDefaultLanguage(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+baseURL = "https://example.com"
+disableLiveReload = true
+defaultContentLanguage = "en"
+defaultContentLanguageInSubdir = true
+[languages]
+[languages.en]
+weight = 1
+[languages.nn]
+weight = 2
+-- content/p1/index.en.md --
+---
+title: "P1 en"
+---
+P1 en.
+-- content/p1/b.en.md --
+---
+title: "B en"
+---
+B en.
+-- content/p1/f1.en.txt --
+F1 en
+-- content/p1/index.nn.md --
+---
+title: "P1 nn"
+---
+P1 nn.
+-- content/p1/b.nn.md --
+---
+title: "B nn"
+---
+B nn.
+-- content/p1/f1.nn.txt --
+F1 nn
+-- layouts/_default/single.html --
+Single: {{ .Title }}|{{ .Content }}|Bundled File: {{ with .Resources.GetMatch "f1.*" }}{{ .Content }}{{ end }}|Bundled Page: {{ with .Resources.GetMatch "b.*" }}{{ .Content }}{{ end }}|
+`
+
+ b := TestRunning(t, files)
+
+ b.AssertFileContent("public/nn/p1/index.html", "Single: P1 nn|<p>P1 nn.</p>", "F1 nn|")
+ b.EditFileReplaceAll("content/p1/index.nn.md", "P1 nn.", "P1 nn edit.").Build()
+ b.AssertFileContent("public/nn/p1/index.html", "Single: P1 nn|<p>P1 nn edit.</p>\n|")
+ b.EditFileReplaceAll("content/p1/f1.nn.txt", "F1 nn", "F1 nn edit.").Build()
+ b.AssertFileContent("public/nn/p1/index.html", "Bundled File: F1 nn edit.")
+ b.EditFileReplaceAll("content/p1/b.nn.md", "B nn.", "B nn edit.").Build()
+ b.AssertFileContent("public/nn/p1/index.html", "B nn edit.")
+}
+
func TestRebuildVariationsAssetsSassImport(t *testing.T) {
if !htesting.IsCI() {
t.Skip("skip CI only")