feat: customize prev and next page link in the page footer

This commit is contained in:
Dillon 2022-05-29 22:27:36 +08:00
parent d2d66e5163
commit 4b24331134
No known key found for this signature in database
GPG key ID: 0EF4AE57FB98F108

View file

@ -62,11 +62,24 @@
</div>
<div class="post-nav">
{{- if .PrevInSection -}}
<a href="{{ .PrevInSection.RelPermalink }}" class="prev" rel="prev" title="{{ .PrevInSection.Title }}"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>{{ .PrevInSection.Title | emojify }}</a>
{{- $prevPage := false -}}
{{- $nextPage := false -}}
{{- if or (.Params.prev) (.Params.next) -}}
{{- with .Params.prev -}}
{{- $prevPage = $.Site.GetPage . -}}
{{- end -}}
{{ if .NextInSection }}
<a href="{{ .NextInSection.RelPermalink }}" class="next" rel="next" title="{{ .NextInSection.Title }}">{{ .NextInSection.Title | emojify }}<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a>
{{- with .Params.next -}}
{{- $nextPage = $.Site.GetPage . -}}
{{- end -}}
{{- else -}}
{{- $prevPage = .PrevInSection -}}
{{- $nextPage = .NextInSection -}}
{{- end -}}
{{- with $prevPage -}}
<a href="{{ .RelPermalink }}" class="prev" rel="prev" title="{{ .Title }}"><i class="fas fa-angle-left fa-fw" aria-hidden="true"></i>{{ .Title | emojify }}</a>
{{- end -}}
{{ with $nextPage }}
<a href="{{ .RelPermalink }}" class="next" rel="next" title="{{ .Title }}">{{ .Title | emojify }}<i class="fas fa-angle-right fa-fw" aria-hidden="true"></i></a>
{{- end -}}
</div>
</div>