birdsounds.media/layouts/partials/next-prev-photo-in-album.html
a 9aa43df629 First commit
The basic parts of the layouts/theme should work. I have only populated 2 albums so far.
2024-05-17 21:14:05 -05:00

43 lines
No EOL
954 B
HTML

{{ 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 }}