github.io/layouts/partials/menu.html

22 lines
498 B
HTML

{{ $currentPage := . }}
{{ if .HasChildren }}
<li class='{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}'>
<a href='#'>{{ .Pre }}<span>{{ .Name }}</span></a>
</li>
<li>
<ul class='sub-menu'>
{{ range .Children }}
<li class='{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}'>
<a href='{{ .URL }}'>{{ .Name }}</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li>
<a href='{{ .URL }}'>
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}