diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 7a135ee..052c4b5 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,6 +1,6 @@ {{ define "main" }} -
- {{ $paginator := .Paginate ((where $.Site.RegularPages "Section" .Section ).ByParam "top") }} +
+ {{ $paginator := .Paginate ((where $.Site.RegularPages "Section" .Section).ByParam "top") }} {{ range $i, $page := $paginator.Pages }} {{ partial "row.html" (dict "page" $page "index" $i) }} {{ end }} @@ -9,30 +9,6 @@ {{ define "pagination" }} - {{ $paginator := .Paginate ((where $.Site.RegularPages "Section" .Section ).ByParam "top") }} - {{ if $paginator.HasPrev }} - -
< Prev
-
- {{ else }} -
< Prev
- {{ end }} - - {{ $current_num := $paginator.PageNumber }} - {{ range $i, $pager := $paginator.Pagers }} - {{ $i = add $i 1}} - {{ if (eq $current_num $i)}} -
{{ $i }}
- {{ else }} -
{{ $i }}
- {{ end }} - {{end}} - - {{ if $paginator.HasNext }} - -
Next >
-
- {{ else }} -
Next >
- {{ end }} -{{ end }} \ No newline at end of file + {{ $paginator := .Paginate ((where $.Site.RegularPages "Section" .Section).ByParam "top") }} + {{ partial "pagination.html" (dict "paginator" $paginator) }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 172a7c1..6b03ab2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -13,28 +13,5 @@ {{ define "pagination" }} {{ $paginator := .Paginate (.Site.RegularPages.ByParam "top") }} - {{ if $paginator.HasPrev }} - -
< Prev
-
- {{ else }} -
< Prev
- {{ end }} - - {{ $current_num := $paginator.PageNumber }} - {{ range (seq 1 $paginator.TotalPages) }} - {{ if (eq $current_num .)}} -
{{.}}
- {{ else }} -
{{.}}
- {{ end }} - {{end}} - - {{ if $paginator.HasNext }} - -
Next >
-
- {{ else }} -
Next >
- {{ end }} + {{ partial "pagination.html" (dict "paginator" $paginator) }} {{ end }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..f90572e --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,83 @@ +{{ $paginator := .paginator }} + \ No newline at end of file