@@ -29,6 +29,7 @@ title: %q
29
29
weight: %d
30
30
menu:
31
31
%s:
32
+ title: %s
32
33
weight: %d
33
34
---
34
35
# Doc Menu
@@ -44,11 +45,15 @@ title = "Section Menu"
44
45
sectionPagesMenu = "sect"
45
46
`
46
47
47
- th , h := newTestSitesFromConfig (t , afero .NewMemMapFs (), siteConfig ,
48
- "layouts/partials/menu.html" , `{{- $p := .page -}}
48
+ th , h := newTestSitesFromConfig (
49
+ t ,
50
+ afero .NewMemMapFs (),
51
+ siteConfig ,
52
+ "layouts/partials/menu.html" ,
53
+ `{{- $p := .page -}}
49
54
{{- $m := .menu -}}
50
55
{{ range (index $p.Site.Menus $m) -}}
51
- {{- .URL }}|{{ .Name }}|{{ .Weight -}}|
56
+ {{- .URL }}|{{ .Name }}|{{ .Title }}|{{ . Weight -}}|
52
57
{{- if $p.IsMenuCurrent $m . }}IsMenuCurrent{{ else }}-{{ end -}}|
53
58
{{- if $p.HasMenuCurrent $m . }}HasMenuCurrent{{ else }}-{{ end -}}|
54
59
{{- end -}}
@@ -63,11 +68,11 @@ Menu Main: {{ partial "menu.html" (dict "page" . "menu" "main") }}`,
63
68
64
69
fs := th .Fs
65
70
66
- writeSource (t , fs , "content/sect1/p1.md" , fmt .Sprintf (menuPageTemplate , "p1" , 1 , "main" , 40 ))
67
- writeSource (t , fs , "content/sect1/p2.md" , fmt .Sprintf (menuPageTemplate , "p2" , 2 , "main" , 30 ))
68
- writeSource (t , fs , "content/sect2/p3.md" , fmt .Sprintf (menuPageTemplate , "p3" , 3 , "main" , 20 ))
69
- writeSource (t , fs , "content/sect2/p4.md" , fmt .Sprintf (menuPageTemplate , "p4" , 4 , "main" , 10 ))
70
- writeSource (t , fs , "content/sect3/p5.md" , fmt .Sprintf (menuPageTemplate , "p5" , 5 , "main" , 5 ))
71
+ writeSource (t , fs , "content/sect1/p1.md" , fmt .Sprintf (menuPageTemplate , "p1" , 1 , "main" , "atitle1" , 40 ))
72
+ writeSource (t , fs , "content/sect1/p2.md" , fmt .Sprintf (menuPageTemplate , "p2" , 2 , "main" , "atitle2" , 30 ))
73
+ writeSource (t , fs , "content/sect2/p3.md" , fmt .Sprintf (menuPageTemplate , "p3" , 3 , "main" , "atitle3" , 20 ))
74
+ writeSource (t , fs , "content/sect2/p4.md" , fmt .Sprintf (menuPageTemplate , "p4" , 4 , "main" , "atitle4" , 10 ))
75
+ writeSource (t , fs , "content/sect3/p5.md" , fmt .Sprintf (menuPageTemplate , "p5" , 5 , "main" , "atitle5" , 5 ))
71
76
72
77
writeNewContentFile (t , fs , "Section One" , "2017-01-01" , "content/sect1/_index.md" , 100 )
73
78
writeNewContentFile (t , fs , "Section Five" , "2017-01-01" , "content/sect5/_index.md" , 10 )
@@ -86,11 +91,24 @@ Menu Main: {{ partial "menu.html" (dict "page" . "menu" "main") }}`,
86
91
require .Len (t , p1 , 1 )
87
92
88
93
th .assertFileContent ("public/sect1/p1/index.html" , "Single" ,
89
- "Menu Sect: /sect5/|Section Five|10|-|-|/sect1/|Section One|100|-|HasMenuCurrent|/sect2/|Sect2s|0|-|-|/sect3/|Sect3s|0|-|-|" ,
90
- "Menu Main: /sect3/p5/|p5|5|-|-|/sect2/p4/|p4|10|-|-|/sect2/p3/|p3|20|-|-|/sect1/p2/|p2|30|-|-|/sect1/p1/|p1|40|IsMenuCurrent|-|" ,
94
+ "Menu Sect: " +
95
+ "/sect5/|Section Five||10|-|-|" +
96
+ "/sect1/|Section One||100|-|HasMenuCurrent|" +
97
+ "/sect2/|Sect2s||0|-|-|" +
98
+ "/sect3/|Sect3s||0|-|-|" ,
99
+ "Menu Main: " +
100
+ "/sect3/p5/|p5|atitle5|5|-|-|" +
101
+ "/sect2/p4/|p4|atitle4|10|-|-|" +
102
+ "/sect2/p3/|p3|atitle3|20|-|-|" +
103
+ "/sect1/p2/|p2|atitle2|30|-|-|" +
104
+ "/sect1/p1/|p1|atitle1|40|IsMenuCurrent|-|" ,
91
105
)
92
106
93
107
th .assertFileContent ("public/sect2/p3/index.html" , "Single" ,
94
- "Menu Sect: /sect5/|Section Five|10|-|-|/sect1/|Section One|100|-|-|/sect2/|Sect2s|0|-|HasMenuCurrent|/sect3/|Sect3s|0|-|-|" )
108
+ "Menu Sect: " +
109
+ "/sect5/|Section Five||10|-|-|" +
110
+ "/sect1/|Section One||100|-|-|" +
111
+ "/sect2/|Sect2s||0|-|HasMenuCurrent|" +
112
+ "/sect3/|Sect3s||0|-|-|" )
95
113
96
114
}
0 commit comments