fix: add docs index page navigation

Signed-off-by: ROOMrepair <twekjz@gmail.com>
This commit is contained in:
ROOMrepair 2024-11-01 10:58:40 +08:00
parent 85ebc72aee
commit 6119b3d8fd
3 changed files with 17 additions and 5 deletions

View File

@ -147,9 +147,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
</div>
</div>
{{ if .IsPage }}
{{ partial "pagination" . }}
{{ end }}
<div></div>
</div>

View File

@ -155,9 +155,7 @@
</div>
</div>
{{ if .IsPage }}
{{ partial "pagination" . }}
{{ end }}
<div></div>
</div>

View File

@ -1,6 +1,7 @@
<div class="page-div common-flex-layout">
{{ if .IsPage }}
<!-- if not each page in a section is pure page we can't simply use prev/nextInsection -->
<!-- or is there a better way -->
<!-- todo!!! is there a better way to solve this ? -->
{{ $current := .}}
{{ $p := .Parent.Pages.ByWeight }}
{{ $length := len $p }}
@ -29,5 +30,20 @@
{{ else }}
{{ partial "page_navigation" (dict "context" . "prev" false)}}
{{ end }}
{{ else }}
<!-- index prev -->
{{ partial "page_navigation" (dict "context" . "prev" true)}}
<!-- index next -->
{{ $pages:= .Pages.ByWeight}}
{{ if gt $pages 0}}
{{ with (index $pages 0)}}
<a class="next" href="{{.RelPermalink}}">
{{ i18n "Next" }}
<span>: {{.LinkTitle}}</span>
<img src="/images/docs/v3.3/next.svg" alt="{{ i18n " Next" }}">
</a>
{{ end }}
{{ end }}
{{ end }}
</div>