hugo-book/layouts/_partials/docs/prev-next.html
2025-07-20 13:12:19 +02:00

32 lines
1.0 KiB
HTML

{{ $bookSection := default "docs" .Site.Params.BookSection }}
{{ if eq $bookSection "*" }}
{{ $bookSection = "/" }}{{/* Backward compatibility */}}
{{ end }}
{{ with .Site.GetPage $bookSection }}
{{ $pages := partialCached "docs/prev-next-cache" .Pages }}
{{ $prev := $pages.Next $ }}
{{ $next := $pages.Prev $ }}
{{- if or $prev $next }}
<div class="flex flex-wrap justify-between">
<span>
{{ with $prev }}
<a href="{{ .RelPermalink }}" class="flex align-center book-icon">
<img src="{{ "svg/backward.svg" | relURL }}" alt="Previous" title="{{ partial "docs/title" . }}" />
<span>{{ partial "docs/title" . }}</span>
</a>
{{ end }}
</span>
<span>
{{ with $next }}
<a href="{{ .RelPermalink }}" class="flex align-center book-icon">
<span>{{ partial "docs/title" . }}</span>
<img src="{{ "svg/forward.svg" | relURL }}" alt="Next" title="{{ partial "docs/title" . }}" />
</a>
{{ end }}
</span>
</div>
{{ end -}}
{{ end }}