InkSoul/themes/meme_cdn/layouts/partials/components/post-nav.html

26 lines
1.0 KiB
HTML

{{ if and .Site.Params.enablePostNav (in .Site.Params.mainSections .Section) }}
{{ if .Site.Params.postNavInSection }}
{{ .Scratch.Set "prev" .PrevInSection }}
{{ .Scratch.Set "next" .NextInSection }}
{{ else }}
{{ .Scratch.Set "prev" .PrevPage }}
{{ .Scratch.Set "next" .NextPage }}
{{ end }}
{{ $prev := .Scratch.Get "prev" }}
{{ $next := .Scratch.Get "next" }}
{{ if or $prev $next }}
<ul class="post-nav">
{{ if $next }}
<li class="post-nav-prev">
<a href="{{ $next.RelPermalink }}" rel="prev">&lt; {{ (partial "utils/title.html" (dict "$" $next "title" $next.LinkTitle)).htmlTitle }}</a>
</li>
{{ end }}
{{ if $prev }}
<li class="post-nav-next">
<a href="{{ $prev.RelPermalink }}" rel="next">{{ (partial "utils/title.html" (dict "$" $prev "title" $prev.LinkTitle)).htmlTitle }} &gt;</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}