61 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{ $page := . }}
 | 
						|
 | 
						|
{{ $basepath := path.Clean (urls.Parse (relLangURL "")).Path }}
 | 
						|
{{ $pills := false }}
 | 
						|
{{ $tabs := false }}
 | 
						|
{{ $underline := false }}
 | 
						|
 | 
						|
{{ if eq $basepath "/" }}
 | 
						|
    {{ $basepath = "" }}
 | 
						|
{{ end }}
 | 
						|
 | 
						|
{{ $pagepath := strings.TrimPrefix $basepath $page.RelPermalink }}
 | 
						|
 | 
						|
{{ with $page.Param "paige.menu.style" }}
 | 
						|
    {{ if eq . "pills" }}
 | 
						|
        {{ $pills = true }}
 | 
						|
    {{ else if eq . "tabs" }}
 | 
						|
        {{ $tabs = true }}
 | 
						|
    {{ else if eq . "underline" }}
 | 
						|
        {{ $underline = true }}
 | 
						|
    {{ else if ne . "links" }}
 | 
						|
        {{ errorf "layouts/partials/paige/menu.html: invalid menu style: %q" . }}
 | 
						|
    {{ end }}
 | 
						|
{{ else }}
 | 
						|
    {{ $pills = true }}
 | 
						|
{{ end }}
 | 
						|
 | 
						|
{{ with site.Menus.main }}
 | 
						|
    <nav>
 | 
						|
        <ul class="align-items-center justify-content-center nav {{ if $pills }} nav-pills {{ else if $tabs }} nav-tabs {{ else if $underline }} nav-underline {{ end }}">
 | 
						|
            {{ range . }}
 | 
						|
                {{ $menupath := strings.TrimPrefix $basepath .URL }}
 | 
						|
                {{ $home := and (eq $menupath "/") (eq $pagepath "/") }}
 | 
						|
                {{ $menuprefix := and (ne $menupath "/") (hasPrefix $pagepath $menupath) }}
 | 
						|
                {{ $sectionprefix := and (ne $menupath "/") (hasPrefix $menupath (printf "/%s/" $page.Section)) }}
 | 
						|
                {{ $active := or $home $menuprefix $sectionprefix }}
 | 
						|
 | 
						|
                <li class="nav-item {{ if .Children }} dropdown {{ end }}">
 | 
						|
                    <a {{ if $active }} aria-current="page" {{ end }} {{ if .Children }} aria-expanded="false" {{ end }} class="{{ if $active }} active {{ end }} {{ if .Params.paige.disabled }} disabled {{ end }} nav-link {{ if .Children }} dropdown-toggle {{ end }}" {{ if .Children }} data-bs-toggle="dropdown" {{ end }} href="{{ if .Children -}} # {{- else -}} {{ .URL | safeURL }} {{- end }}" {{ if .Children }} role="button" {{ end }}>{{ .Name }}</a>
 | 
						|
 | 
						|
                    {{ with .Children }}
 | 
						|
                        <ul class="dropdown-menu">
 | 
						|
                            {{ range . }}
 | 
						|
                                <li>
 | 
						|
                                    <a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL | safeURL }}">{{ .Name }}</a>
 | 
						|
                                </li>
 | 
						|
 | 
						|
                                {{ if .Params.paige.divider_below }}
 | 
						|
                                    <li>
 | 
						|
                                        <hr class="dropdown-divider">
 | 
						|
                                    </li>
 | 
						|
                                {{ end }}
 | 
						|
                            {{ end }}
 | 
						|
                        </ul>
 | 
						|
                    {{ end }}
 | 
						|
                </li>
 | 
						|
            {{ end }}
 | 
						|
        </ul>
 | 
						|
    </nav>
 | 
						|
{{ end }}
 |