Эх сурвалжийг харах

Update navbar to allow nested links

The navbar is now capable of having links nested under each other.
Bee Hudson 1 жил өмнө
parent
commit
d7dac786a7

+ 11 - 1
layouts/partials/header.html

@@ -5,7 +5,17 @@
 	<nav>
 	<nav>
 		<ul>
 		<ul>
 			{{ range .Site.Menus.main }}
 			{{ range .Site.Menus.main }}
-			<li><a href="{{ .URL }}">{{ .Name }}</a></li>
+				{{ if .HasChildren }}
+				<li><a href="{{ .URL }}">{{ .Name }}</a>
+					<ul>
+						{{ range .Children }}
+						<li><a href="{{ .URL }}">&ndash; {{ .Name }}</a></li>
+						{{ end }}
+					</ul>
+				</li>
+				{{ else }}
+				<li><a href="{{ .URL }}">{{ .Name }}</a></li>
+				{{ end }}
 			{{ end }}
 			{{ end }}
 		</ul>
 		</ul>
 	</nav>
 	</nav>