43 lines
1.2 KiB
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 }}
|