summaryrefslogtreecommitdiffstats
path: root/hugolib/menu_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/menu_test.go')
-rw-r--r--hugolib/menu_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go
index 8ff74304b..816ffb676 100644
--- a/hugolib/menu_test.go
+++ b/hugolib/menu_test.go
@@ -636,3 +636,43 @@ Menu Item: {{ $i }}|{{ .URL }}|
Menu Item: 0|/foo/posts|
`)
}
+
+func TestSectionPagesMenuMultilingualWarningIssue12306(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['section','rss','sitemap','taxonomy','term']
+defaultContentLanguageInSubdir = true
+sectionPagesMenu = "main"
+[languages.en]
+[languages.fr]
+-- layouts/_default/home.html --
+{{- range site.Menus.main -}}
+ <a href="{{ .URL }}">{{ .Name }}</a>
+{{- end -}}
+-- layouts/_default/single.html --
+{{ .Title }}
+-- content/p1.en.md --
+---
+title: p1
+menu: main
+---
+-- content/p1.fr.md --
+---
+title: p1
+menu: main
+---
+-- content/p2.en.md --
+---
+title: p2
+menu: main
+---
+`
+
+ b := Test(t, files, TestOptWarn())
+
+ b.AssertFileContent("public/en/index.html", `<a href="/en/p1/">p1</a><a href="/en/p2/">p2</a>`)
+ b.AssertFileContent("public/fr/index.html", `<a href="/fr/p1/">p1</a>`)
+ b.AssertLogNotContains("WARN")
+}