basic-theme/layouts/partials/site-menu.html

30 lines
771 B
HTML
Raw Normal View History

<ul>
2019-11-25 02:39:29 +00:00
{{ if not .IsHome }}
<li><a href="{{ .Site.BaseURL }}">Home</a></li>
{{ end }}
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- if .HasChildren -}}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{- end -}}
{{ end }}
</ul>