birdsounds.media/layouts/partials/next-prev-photo-in-album.html

43 lines
954 B
HTML
Raw Permalink Normal View History

{{ range (.GetTerms "albums") }}
<!-- Get next page -->
{{ $pageReached := false }}
{{ $next := false }}
{{ range .Pages.Reverse }}
{{ if not $next}}
{{ if $pageReached }}
{{ $next = . }}
{{ else if eq .Permalink $.Permalink }}
{{ $pageReached = true}}
{{ end }}
{{ end }}
{{ end }}
<!-- Get previous page -->
{{ $pageReached = false }}
{{ $prev := false }}
{{ range .Pages }}
{{ if not $prev}}
{{ if $pageReached }}
{{ $prev = . }}
{{ else if eq .Permalink $.Permalink }}
{{ $pageReached = true}}
{{ end }}
{{ end }}
{{ end }}
<!-- Print album info -->
<nav class="album-nav">
<header>
<h2>Part of an album:</h2>
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</header>
<div class="nav-buttons">
{{ if $prev }}
<a href="{{ $prev.Permalink }}">← previous</a>
{{ end }}
{{ if $next }}
<a href="{{ $next.Permalink }}">next →</a>
{{ end }}
</div>
</nav>
{{ end }}