Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kongdivin/hugo-theme-okayish-blog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivin Kong <divin@okayish.dev>2020-03-04 09:31:32 +0300
committerDivin Kong <divin@okayish.dev>2020-03-04 09:31:32 +0300
commitf2379798473a91086b5f5380b022ab034e071c84 (patch)
treeac06332373a84f1a6aee2da0c96a4c18902b9c9c
parent483bd187c237fd67cab0c9fd81b301bae03e8bfa (diff)
Change pagination behaviourv1.0.3
Current pagination links only to pages in the same subsections. With this change, the pagination will also include other pages as long as they are in the same section.
-rw-r--r--layouts/partials/single/pagination.html14
1 files changed, 8 insertions, 6 deletions
diff --git a/layouts/partials/single/pagination.html b/layouts/partials/single/pagination.html
index 409a3f7..037dd75 100644
--- a/layouts/partials/single/pagination.html
+++ b/layouts/partials/single/pagination.html
@@ -1,18 +1,20 @@
<div class="p-article-pagination">
- {{ if .PrevInSection }}
- <a class="p-article-pagination__link--previous" href="{{ .PrevInSection.Permalink }}">
+ {{ $pagesInSection := (where .Site.RegularPages "Section" .Section) }}
+
+ {{ with $pagesInSection.Prev . }}
+ <a class="p-article-pagination__link--previous" href="{{ .Permalink }}">
<span class="p-article-pagination__label">{{ i18n "previous" | default "Previous" }}</span>
<span class="p-article-pagination__title">
- {{ .PrevInSection.Title }}
+ {{ .Title }}
</span>
</a>
{{ end }}
- {{ if .NextInSection }}
- <a class="p-article-pagination__link--next" href="{{ .NextInSection.Permalink }}">
+ {{ with $pagesInSection.Next . }}
+ <a class="p-article-pagination__link--next" href="{{ .Permalink }}">
<span class="p-article-pagination__label">{{ i18n "next" | default "Next" }}</span>
<span class="p-article-pagination__title">
- {{ .NextInSection.Title }}
+ {{ .Title }}
</span>
</a>
{{ end }}