hugo-theme-hyde-hyde/layouts/partials/sidebar/menu.html
2019-06-16 17:15:27 +01:00

27 lines
667 B
HTML

<div>
<ul class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li {{ if $currentPage.HasMenuCurrent "main" . }}class="active"{{ end }}>
<a href="#">{{ .Pre }}
<span>{{ .Name }}</span>
</a>
<ul class="sidebar-nav">
{{ range .Children }}
<li {{ if $currentPage.IsMenuCurrent "main" . }}class="active"{{ end }}>
<a href="{{ .URL }}">{{ .Name | title }}</a>
</li>
{{ end }}
</ul>
</li>
{{ else }} <!-- No children -->
<li>
<a href="{{.URL}}">{{ .Pre }}
<span>{{ .Name | title }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>