summaryrefslogtreecommitdiffstats
path: root/hugolib/node_as_page_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-12-11 13:01:11 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-12-11 16:16:24 +0100
commit83c6806576a27942d49ff0cf81712b14bfda43e0 (patch)
tree7a4ed5b2e0c5e8ce3b43eb217176e92c2f6d4d08 /hugolib/node_as_page_test.go
parentc7f67dd63c60ef88cd76d8497abff864690919ed (diff)
Fix menu URL for node type pages
By delaying the menu assembly. Fixes #2770
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r--hugolib/node_as_page_test.go37
1 files changed, 35 insertions, 2 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go
index e40b2874a..5cca25fb5 100644
--- a/hugolib/node_as_page_test.go
+++ b/hugolib/node_as_page_test.go
@@ -430,6 +430,22 @@ menu:
---
`)
+ writeSource(t, filepath.Join("content", "sect1", "_index.md"), `---
+title: Sect1 With Menu
+menu:
+ mymenu:
+ name: "Go Sect1!"
+---
+`)
+
+ writeSource(t, filepath.Join("content", "categories", "hugo", "_index.md"), `---
+title: Taxonomy With Menu
+menu:
+ mymenu:
+ name: "Go Tax Hugo!"
+---
+`)
+
viper.Set("paginate", 1)
viper.Set("title", "Hugo Rocks!")
@@ -439,7 +455,9 @@ menu:
t.Fatalf("Failed to build site: %s", err)
}
- assertFileContent(t, filepath.Join("public", "index.html"), true, "Home With Menu", "Menu Item: Go Home!")
+ assertFileContent(t, filepath.Join("public", "index.html"), true, "Home With Menu", "Home Menu Item: Go Home!: /")
+ assertFileContent(t, filepath.Join("public", "sect1", "index.html"), true, "Sect1 With Menu", "Section Menu Item: Go Sect1!: /sect1/")
+ assertFileContent(t, filepath.Join("public", "categories", "hugo", "index.html"), true, "Taxonomy With Menu", "Taxonomy Menu Item: Go Tax Hugo!: /categories/hugo/")
}
@@ -644,7 +662,7 @@ Index Content: {{ .Content }}
{{ end }}
{{ with .Site.Menus.mymenu }}
{{ range . }}
-Menu Item: {{ .Name }}
+Home Menu Item: {{ .Name }}: {{ .URL }}
{{ end }}
{{ end }}
Date: {{ .Date.Format "2006-01-02" }}
@@ -666,6 +684,11 @@ Section Content: {{ .Content }}
{{ range .Paginator.Pages }}
Pag: {{ .Title }}
{{ end }}
+{{ with .Site.Menus.mymenu }}
+{{ range . }}
+Section Menu Item: {{ .Name }}: {{ .URL }}
+{{ end }}
+{{ end }}
Date: {{ .Date.Format "2006-01-02" }}
Lastmod: {{ .Lastmod.Format "2006-01-02" }}
`)
@@ -678,6 +701,11 @@ Taxonomy Content: {{ .Content }}
{{ range .Paginator.Pages }}
Pag: {{ .Title }}
{{ end }}
+{{ with .Site.Menus.mymenu }}
+{{ range . }}
+Taxonomy Menu Item: {{ .Name }}: {{ .URL }}
+{{ end }}
+{{ end }}
Date: {{ .Date.Format "2006-01-02" }}
Lastmod: {{ .Lastmod.Format "2006-01-02" }}
`)
@@ -689,6 +717,11 @@ Taxonomy Terms Content: {{ .Content }}
{{ range $key, $value := .Data.Terms }}
k/v: {{ $key }} / {{ printf "%s" $value }}
{{ end }}
+{{ with .Site.Menus.mymenu }}
+{{ range . }}
+Taxonomy Terms Menu Item: {{ .Name }}: {{ .URL }}
+{{ end }}
+{{ end }}
Date: {{ .Date.Format "2006-01-02" }}
Lastmod: {{ .Lastmod.Format "2006-01-02" }}
`)