Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow overriding prev and next links in frontmatter (#15755) #16044

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
18 changes: 13 additions & 5 deletions layouts/partials/posts_navigation.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{{ $skipPageNav := .Scratch.Get "skipPageNav" }}
{{ if not (or .Params.skip_pagenav $skipPageNav) }}
{{ if or .NextInSection .PrevInSection }}
{{$prev := .PrevInSection}}
{{$next := .NextInSection}}
AdeshGhadage marked this conversation as resolved.
Show resolved Hide resolved
{{ with .Params.prevInSection }}
AdeshGhadage marked this conversation as resolved.
Show resolved Hide resolved
{{$prev = .}}
AdeshGhadage marked this conversation as resolved.
Show resolved Hide resolved
{{ end }}
{{ with .Params.nextInSection }}
AdeshGhadage marked this conversation as resolved.
Show resolved Hide resolved
{{$next = .}}
{{ end }}
{{ if or $prev $next }}
AdeshGhadage marked this conversation as resolved.
Show resolved Hide resolved
<nav class="pagenav">
<div class="left">
{{ if .NextInSection }}
<a title="{{ .NextInSection.Description }}" href="{{ .NextInSection.Permalink }}" class="next-link">{{- partial "icon.html" "left-arrow" -}}{{- .NextInSection.LinkTitle -}}</a>
{{ if $prev }}
<a title="{{ $prev.Description }}" href="{{ $prev.Permalink }}" class="next-link">{{- partial "icon.html" "left-arrow" -}}{{- $prev.LinkTitle -}}</a>
{{ end }}
</div>
<div class="right">
{{ if .PrevInSection }}
<a title="{{ .PrevInSection.Description }}" href="{{ .PrevInSection.Permalink }}" class="next-link">{{- .PrevInSection.LinkTitle -}}{{- partial "icon.html" "right-arrow" -}}</a>
{{ if $next }}
<a title="{{ $next.Description }}" href="{{ $next.Permalink }}" class="next-link">{{- $next.LinkTitle -}}{{- partial "icon.html" "right-arrow" -}}</a>
{{ end }}
</div>
</nav>
Expand Down