Complete site header logic

master
Will Faught 12 months ago
parent 83646fa829
commit 6dbc56c2b6

@ -1,8 +1,12 @@
{{ $page := . }} {{ $page := . }}
{{ $ancestors := $page.Ancestors }}
{{ $basepath := path.Clean (urls.Parse (relLangURL "")).Path }} {{ $basepath := path.Clean (urls.Parse (relLangURL "")).Path }}
{{ $description := $page.Param "paige.site_description" }} {{ $description := $page.Param "paige.site_description" }}
{{ $first := templates.Exists "partials/paige/header-first.html" }}
{{ $last := templates.Exists "partials/paige/header-last.html" }}
{{ $links := false }} {{ $links := false }}
{{ $menu := site.Menus.main }}
{{ $pills := false }} {{ $pills := false }}
{{ $tabs := false }} {{ $tabs := false }}
{{ $title := $page.Param "paige.site_title" }} {{ $title := $page.Param "paige.site_title" }}
@ -28,9 +32,9 @@
{{ $links = true }} {{ $links = true }}
{{ end }} {{ end }}
{{ if or $page.Ancestors site.Menus.main }} {{ if or $ancestors $description $first $last $menu $title }}
<header class="my-3" id="paige-header"> <header class="my-3" id="paige-header">
{{ if templates.Exists "partials/paige/header-first.html" }} {{ if $first }}
{{ partial "paige/header-first.html" $page }} {{ partial "paige/header-first.html" $page }}
{{ end }} {{ end }}
@ -46,7 +50,7 @@
</div> </div>
{{ end }} {{ end }}
{{ with site.Menus.main }} {{ with $menu }}
<nav> <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 }}"> <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 . }} {{ range . }}
@ -80,7 +84,7 @@
</nav> </nav>
{{ end }} {{ end }}
{{ with .Ancestors }} {{ with $ancestors }}
<nav aria-label="{{ i18n `paige_breadcrumbs` }}" class="mt-3" id="paige-breadcrumbs"> <nav aria-label="{{ i18n `paige_breadcrumbs` }}" class="mt-3" id="paige-breadcrumbs">
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<ol class="breadcrumb mb-0"> <ol class="breadcrumb mb-0">
@ -102,7 +106,7 @@
</nav> </nav>
{{ end }} {{ end }}
{{ if templates.Exists "partials/paige/header-last.html" }} {{ if $last }}
{{ partial "paige/header-last.html" $page }} {{ partial "paige/header-last.html" $page }}
{{ end }} {{ end }}
</header> </header>

Loading…
Cancel
Save