You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pages/layouts/partials/menu.html

43 lines
1.2 KiB
HTML

{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ $url := .URL | absURL }}
{{ $active := or (eq $currentPage.Permalink (absURL .URL)) ($currentPage.IsMenuCurrent "main" .) }}
{{ if .HasChildren }}
<li class="nav-item dropdown">
<a
class="nav-link pl-0 dropdown-toggle {{ if $active }}active{{ end }}"
href="{{ $url }}"
data-bs-toggle="dropdown"
role="button"
aria-haspopup="true"
aria-expanded="false"
>
<i class="{{ .Params.prefix }} {{ .Params.icon }} fa-fw"></i>
{{ .Name }}
</a>
<div class="dropdown-menu">
{{ range .Children }}
{{ $childurl := .URL | absURL }}
<a
class="dropdown-item {{ if $active }}active{{ end }}"
href="{{ $childurl }}"
>
<i class="{{ .Params.prefix }} {{ .Params.icon }} fa-fw"></i>
{{ .Name }}
</a>
{{ end }}
</div>
</li>
{{ else }}
<li class="nav-item">
<a
class="nav-link pl-0 {{ if $active }}active{{ end }}"
href="{{ $url }}"
>
<i class="{{ .Params.prefix }} {{ .Params.icon }} fa-fw"></i>
{{ .Name }}
</a>
</li>
{{ end }}
{{ end }}