mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -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) {
|
||||
//jww.SetStdoutThreshold(jww.LevelDebug)
|
||||
//defer jww.SetStdoutThreshold(jww.LevelFatal)
|
||||
testCommonResetState()
|
||||
|
||||
writeLayoutsForNodeAsPageTests(t)
|
||||
|
@ -314,7 +312,6 @@ categories: [
|
|||
|
||||
viper.Set("paginate", 1)
|
||||
viper.Set("title", "Hugo Rocks!")
|
||||
viper.Set("rssURI", "customrss.xml")
|
||||
|
||||
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) {
|
||||
writeRegularPagesForNodeAsPageTestsWithLang(t, "")
|
||||
}
|
||||
|
@ -408,6 +434,11 @@ Index Content: {{ .Content }}
|
|||
{{ range .Paginator.Pages }}
|
||||
Pag: {{ .Title }}
|
||||
{{ end }}
|
||||
{{ with .Site.Menus.mymenu }}
|
||||
{{ range . }}
|
||||
Menu Item: {{ .Name }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
`)
|
||||
|
||||
writeSource(t, filepath.Join("layouts", "_default", "single.html"), `
|
||||
|
|
|
@ -1427,8 +1427,7 @@ func (s *Site) assembleMenus() {
|
|||
sectionPagesMenu := s.Language.GetString("SectionPagesMenu")
|
||||
sectionPagesMenus := make(map[string]interface{})
|
||||
//creating flat hash
|
||||
// TODO(bep) np menu
|
||||
pages := s.findPagesByNodeType(NodePage)
|
||||
pages := s.Nodes
|
||||
for _, p := range pages {
|
||||
|
||||
if sectionPagesMenu != "" {
|
||||
|
|
Loading…
Reference in a new issue