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.

110 lines
5.0 KiB
HTML

{{ $page := . }}
{{ $basepath := path.Clean (urls.Parse (relLangURL "")).Path }}
{{ $description := $page.Param "paige.site_description" }}
{{ $links := false }}
{{ $pills := false }}
{{ $tabs := false }}
{{ $title := $page.Param "paige.site_title" }}
{{ $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 }}
{{ $links = true }}
{{ end }}
{{ else }}
{{ $links = true }}
{{ end }}
{{ if or $page.Ancestors site.Menus.main }}
<header class="my-3" id="paige-header">
{{ if templates.Exists "partials/paige/header-first.html" }}
{{ partial "paige/header-first.html" $page }}
{{ end }}
{{ if or $description $title }}
<div class="mb-3 text-center" id="paige-site-header">
{{ with $title }}
<p class="display-1 fw-bold mb-2" id="paige-site-title">{{ . | markdownify }}</p>
{{ end }}
{{ with $description }}
<p class="lead" id="paige-site-description">{{ . | markdownify }}</p>
{{ end }}
</div>
{{ 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 {{ if $links }} text-body-emphasis {{ end }} {{ end }} {{ if .Params.paige.disabled }} disabled {{ end }} nav-link {{ if .Children }} dropdown-toggle {{ end }} {{ if $links }} text-decoration-underline {{ end }}" {{ if .Children }} data-bs-toggle="dropdown" {{ end }} href="{{ if .Children -}} # {{- else -}} {{ .URL | safeURL }} {{- end }}" {{ if .Children }} role="button" {{ end }} {{ if not .Children }} {{ with partial "paige/target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }} {{ end }}>{{ .Name }}</a>
{{ with .Children }}
<ul class="dropdown-menu">
{{ range . }}
<li>
<a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL | safeURL }}" {{ with partial "paige/target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }}>{{ .Name }}</a>
</li>
{{ if .Params.paige.divider_below }}
<li>
<hr class="dropdown-divider">
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
</li>
{{ end }}
</ul>
</nav>
{{ end }}
{{ with .Ancestors }}
<nav aria-label="{{ i18n `paige_breadcrumbs` }}" class="mt-3" id="paige-breadcrumbs">
<div class="d-flex justify-content-center">
<ol class="breadcrumb mb-0">
{{ $reverse := .Reverse }}
{{ $last := sub (len $reverse) 1 }}
{{ range $i, $ancestor := $reverse }}
{{ $title := $ancestor.Title }}
{{ if and (eq $i $last) (not $title) }}
{{ $title = $page.Param "paige.site_title" | default (site.Title) }}
{{ end }}
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}">{{ $title | markdownify | plainify | htmlUnescape }}</a></li>
{{ end }}
</ol>
</div>
</nav>
{{ end }}
{{ if templates.Exists "partials/paige/header-last.html" }}
{{ partial "paige/header-last.html" $page }}
{{ end }}
</header>
{{ end }}