mirror of
https://github.com/kubesphere/website.git
synced 2025-12-26 00:12:48 +00:00
33 lines
887 B
HTML
33 lines
887 B
HTML
<div class="page-div common-flex-layout">
|
|
<!-- if not each page in a section is pure page we can't simply use prev/nextInsection -->
|
|
<!-- or is there a better way -->
|
|
{{ $current := .}}
|
|
{{ $p := .Parent.Pages.ByWeight }}
|
|
{{ $length := len $p }}
|
|
|
|
<!-- find current page's section position -->
|
|
{{ $curIndex := 0 }}
|
|
{{ range $i, $p_sec := $p}}
|
|
|
|
{{ if eq $p_sec $current}}
|
|
{{ $curIndex = $i }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
<!-- prev -->
|
|
{{ if gt $curIndex 0}}
|
|
{{ $prevPage := index $p (sub $curIndex 1) }}
|
|
{{ partial "findLastInPreSection" $prevPage}}
|
|
{{ else }}
|
|
{{ partial "page_navigation" (dict "context" . "prev" true)}}
|
|
{{ end }}
|
|
|
|
<!-- next -->
|
|
{{ if lt $curIndex (sub $length 1) }}
|
|
{{ $nextPage := index $p (add $curIndex 1)}}
|
|
{{ partial "findFirstInNextSection" $nextPage}}
|
|
{{ else }}
|
|
{{ partial "page_navigation" (dict "context" . "prev" false)}}
|
|
{{ end }}
|
|
|
|
</div> |