Have page footer only if needed

master
Will Faught 12 months ago
parent fd469910de
commit f0978c71a7

@ -2,57 +2,64 @@
{{ $fileediturl := $page.Param "paige.file_edit_url" }} {{ $fileediturl := $page.Param "paige.file_edit_url" }}
{{ $filehistoryurl := $page.Param "paige.file_history_url" }} {{ $filehistoryurl := $page.Param "paige.file_history_url" }}
{{ $file := false }}
{{ $first := templates.Exists "partials/paige/page-footer-first.html" }}
{{ $last := templates.Exists "partials/paige/page-footer-last.html" }}
{{ $next := $page.NextInSection }} {{ $next := $page.NextInSection }}
{{ $prev := $page.PrevInSection }} {{ $prev := $page.PrevInSection }}
{{ if $page.File }} {{ if $page.File }}
{{ if $fileediturl }} {{ if $fileediturl }}
{{ $file = true }}
{{ $fileediturl = printf $fileediturl $page.File.Path }} {{ $fileediturl = printf $fileediturl $page.File.Path }}
{{ end }} {{ end }}
{{ if $filehistoryurl }} {{ if $filehistoryurl }}
{{ $file = true }}
{{ $filehistoryurl = printf $filehistoryurl $page.File.Path }} {{ $filehistoryurl = printf $filehistoryurl $page.File.Path }}
{{ end }} {{ end }}
{{ end }} {{ end }}
<footer class="mt-3 text-center text-secondary" id="paige-page-footer"> {{ if or $file $first $last $next $prev }}
{{ if templates.Exists "partials/paige/page-footer-first.html" }} <footer class="mt-3 mw-100 text-center text-secondary" id="paige-page-footer">
{{ partial "paige/page-footer-first.html" . }} {{ if $first }}
{{ end }} {{ partial "paige/page-footer-first.html" . }}
{{ end }}
{{ if or $next $prev }}
<div class="mb-3" id="paige-prev-next">
{{ with $prev }}
<p class="mb-0" id="paige-next">
<a class="link-secondary" href="{{ .Permalink }}">{{ .Title }}</a> &rsaquo;
</p>
{{ end }}
{{ if or $next $prev }} {{ with $next }}
<div class="mb-3" id="paige-prev-next"> <p class="mb-0" id="paige-prev">
{{ with $prev }} &lsaquo; <a class="link-secondary" href="{{ .Permalink }}">{{ .Title }}</a>
<p class="mb-0" id="paige-next"> </p>
<a class="link-secondary" href="{{ .Permalink }}">{{ .Title }}</a> &rsaquo; {{ end }}
</div>
{{ end }}
{{ if $file }}
<div id="paige-file">
{{ if $fileediturl }}
<p class="mb-0" id="paige-file-edit">
<a class="link-secondary" href="{{ $fileediturl | safeURL }}">{{ i18n "paige_edit_this_page" }}</a>
</p> </p>
{{ end }} {{ end }}
{{ with $next }} {{ if $filehistoryurl }}
<p class="mb-0" id="paige-prev"> <p class="mb-0" id="paige-file-history">
&lsaquo; <a class="link-secondary" href="{{ .Permalink }}">{{ .Title }}</a> <a class="link-secondary" href="{{ $filehistoryurl | safeURL }}">{{ i18n "paige_edit_history" }}</a>
</p> </p>
{{ end }} {{ end }}
</div> </div>
{{ end }}
{{ if and $page.File (or $fileediturl $filehistoryurl) }}
<div id="paige-file">
{{ if $fileediturl }}
<p class="mb-0" id="paige-file-edit">
<a class="link-secondary" href="{{ $fileediturl | safeURL }}">{{ i18n "paige_edit_this_page" }}</a>
</p>
{{ end }} {{ end }}
{{ if $filehistoryurl }} {{ if $last }}
<p class="mb-0" id="paige-file-history"> {{ partial "paige/page-footer-last.html" . }}
<a class="link-secondary" href="{{ $filehistoryurl | safeURL }}">{{ i18n "paige_edit_history" }}</a>
</p>
{{ end }} {{ end }}
</div> </footer>
{{ end }} {{ end }}
{{ if templates.Exists "partials/paige/page-footer-last.html" }}
{{ partial "paige/page-footer-last.html" . }}
{{ end }}
</footer>

Loading…
Cancel
Save