diff options
author | Dillon <dillonzq@outlook.com> | 2022-05-29 17:27:36 +0300 |
---|---|---|
committer | Dillon <dillonzq@outlook.com> | 2022-05-29 17:27:36 +0300 |
commit | 4b24331134cf1795e4ca8e08f9e318e36b2b9dbb (patch) | |
tree | 5119de43c6aec5fd220bf42813485fb672444ea1 | |
parent | d2d66e5163f1b1d7ad69a80e3e11fb73dc15ac69 (diff) |
feat: customize prev and next page link in the page footer
-rw-r--r-- | layouts/partials/single/footer.html | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/layouts/partials/single/footer.html b/layouts/partials/single/footer.html index 2ef00d44..1ce50db9 100644 --- a/layouts/partials/single/footer.html +++ b/layouts/partials/single/footer.html @@ -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 -}} + {{- 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 -}} - {{ 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 $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> |