mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
parent
d25f7ec172
commit
fd38aee694
2 changed files with 29 additions and 1 deletions
|
@ -653,6 +653,34 @@ Footer: {{ range index site.Menus.footer }}{{ .Name }}|{{ end }}|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue 13384.
|
||||||
|
func TestPagesFromGoTmplMenusMap(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
disableKinds = ['rss','section','sitemap','taxonomy','term']
|
||||||
|
-- content/_content.gotmpl --
|
||||||
|
{{ $menu1 := dict
|
||||||
|
"parent" "main-page"
|
||||||
|
"identifier" "id1"
|
||||||
|
}}
|
||||||
|
{{ $menu2 := dict
|
||||||
|
"parent" "main-page"
|
||||||
|
"identifier" "id2"
|
||||||
|
}}
|
||||||
|
{{ $menus := dict "m1" $menu1 "m2" $menu2 }}
|
||||||
|
{{ .AddPage (dict "path" "p1" "title" "p1" "menus" $menus ) }}
|
||||||
|
|
||||||
|
-- layouts/index.html --
|
||||||
|
Menus: {{ range $k, $v := site.Menus }}{{ $k }}|{{ end }}
|
||||||
|
|
||||||
|
`
|
||||||
|
b := hugolib.Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/index.html", "Menus: m1|m2|")
|
||||||
|
}
|
||||||
|
|
||||||
func TestPagesFromGoTmplMore(t *testing.T) {
|
func TestPagesFromGoTmplMore(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ type PageConfig struct {
|
||||||
Cascade []map[string]any
|
Cascade []map[string]any
|
||||||
Sitemap config.SitemapConfig
|
Sitemap config.SitemapConfig
|
||||||
Build BuildConfig
|
Build BuildConfig
|
||||||
Menus []string
|
Menus any // Can be a string, []string or map[string]any.
|
||||||
|
|
||||||
// User defined params.
|
// User defined params.
|
||||||
Params maps.Params
|
Params maps.Params
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue