mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
ecedc85cb7
commit
7cb0e34dce
2 changed files with 35 additions and 5 deletions
|
@ -296,8 +296,6 @@ title = "Hugo in English"
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNodesWithTaxonomies(t *testing.T) {
|
func TestNodesWithTaxonomies(t *testing.T) {
|
||||||
//jww.SetStdoutThreshold(jww.LevelDebug)
|
|
||||||
//defer jww.SetStdoutThreshold(jww.LevelFatal)
|
|
||||||
testCommonResetState()
|
testCommonResetState()
|
||||||
|
|
||||||
writeLayoutsForNodeAsPageTests(t)
|
writeLayoutsForNodeAsPageTests(t)
|
||||||
|
@ -314,7 +312,6 @@ categories: [
|
||||||
|
|
||||||
viper.Set("paginate", 1)
|
viper.Set("paginate", 1)
|
||||||
viper.Set("title", "Hugo Rocks!")
|
viper.Set("title", "Hugo Rocks!")
|
||||||
viper.Set("rssURI", "customrss.xml")
|
|
||||||
|
|
||||||
s := newSiteDefaultLang()
|
s := newSiteDefaultLang()
|
||||||
|
|
||||||
|
@ -327,6 +324,35 @@ categories: [
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNodesWithMenu(t *testing.T) {
|
||||||
|
//jww.SetStdoutThreshold(jww.LevelDebug)
|
||||||
|
//defer jww.SetStdoutThreshold(jww.LevelFatal)
|
||||||
|
testCommonResetState()
|
||||||
|
|
||||||
|
writeLayoutsForNodeAsPageTests(t)
|
||||||
|
writeRegularPagesForNodeAsPageTests(t)
|
||||||
|
|
||||||
|
writeSource(t, filepath.Join("content", "_index.md"), `---
|
||||||
|
title: Home With Menu
|
||||||
|
menu:
|
||||||
|
mymenu:
|
||||||
|
name: "Go Home!"
|
||||||
|
---
|
||||||
|
`)
|
||||||
|
|
||||||
|
viper.Set("paginate", 1)
|
||||||
|
viper.Set("title", "Hugo Rocks!")
|
||||||
|
|
||||||
|
s := newSiteDefaultLang()
|
||||||
|
|
||||||
|
if err := buildAndRenderSite(s); err != nil {
|
||||||
|
t.Fatalf("Failed to build site: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
assertFileContent(t, filepath.Join("public", "index.html"), true, "Home With Menu", "Menu Item: Go Home!")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func writeRegularPagesForNodeAsPageTests(t *testing.T) {
|
func writeRegularPagesForNodeAsPageTests(t *testing.T) {
|
||||||
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
|
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
|
||||||
}
|
}
|
||||||
|
@ -408,6 +434,11 @@ Index Content: {{ .Content }}
|
||||||
{{ range .Paginator.Pages }}
|
{{ range .Paginator.Pages }}
|
||||||
Pag: {{ .Title }}
|
Pag: {{ .Title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ with .Site.Menus.mymenu }}
|
||||||
|
{{ range . }}
|
||||||
|
Menu Item: {{ .Name }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("layouts", "_default", "single.html"), `
|
writeSource(t, filepath.Join("layouts", "_default", "single.html"), `
|
||||||
|
|
|
@ -1427,8 +1427,7 @@ func (s *Site) assembleMenus() {
|
||||||
sectionPagesMenu := s.Language.GetString("SectionPagesMenu")
|
sectionPagesMenu := s.Language.GetString("SectionPagesMenu")
|
||||||
sectionPagesMenus := make(map[string]interface{})
|
sectionPagesMenus := make(map[string]interface{})
|
||||||
//creating flat hash
|
//creating flat hash
|
||||||
// TODO(bep) np menu
|
pages := s.Nodes
|
||||||
pages := s.findPagesByNodeType(NodePage)
|
|
||||||
for _, p := range pages {
|
for _, p := range pages {
|
||||||
|
|
||||||
if sectionPagesMenu != "" {
|
if sectionPagesMenu != "" {
|
||||||
|
|
Loading…
Reference in a new issue