mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-22 22:45:42 -06:00
Merge pull request #275 from nunocoracao/268-different-pagination-style
✨ Different pagination style by @martinvisser
This commit is contained in:
commit
b81790c034
33 changed files with 272 additions and 34 deletions
|
@ -35,7 +35,10 @@
|
|||
url = "http://tee.pub/lic/qwSlWVBL5zc"
|
||||
weight = 50
|
||||
|
||||
|
||||
#[[main]]
|
||||
# name = "Test"
|
||||
# pageRef = "pagTest"
|
||||
# weight = 1000
|
||||
|
||||
[[main]]
|
||||
identifier = "twitter"
|
||||
|
|
19
exampleSite/content/pagtest/_index.md
Normal file
19
exampleSite/content/pagtest/_index.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: "TEST"
|
||||
date: 2022-06-13T20:55:37+01:00
|
||||
draft: true
|
||||
|
||||
showDate : false
|
||||
showDateUpdated : false
|
||||
showHeadingAnchors : false
|
||||
showPagination : false
|
||||
showReadingTime : false
|
||||
showTableOfContents : true
|
||||
showTaxonomies : false
|
||||
showWordCount : false
|
||||
showSummary : false
|
||||
sharingLinks : false
|
||||
|
||||
cardView: false
|
||||
---
|
||||
|
7
exampleSite/content/pagtest/file1 copy 10.md
Normal file
7
exampleSite/content/pagtest/file1 copy 10.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 11.md
Normal file
7
exampleSite/content/pagtest/file1 copy 11.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 12.md
Normal file
7
exampleSite/content/pagtest/file1 copy 12.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 13.md
Normal file
7
exampleSite/content/pagtest/file1 copy 13.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 14.md
Normal file
7
exampleSite/content/pagtest/file1 copy 14.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 15.md
Normal file
7
exampleSite/content/pagtest/file1 copy 15.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 16.md
Normal file
7
exampleSite/content/pagtest/file1 copy 16.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 17.md
Normal file
7
exampleSite/content/pagtest/file1 copy 17.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 18.md
Normal file
7
exampleSite/content/pagtest/file1 copy 18.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 19.md
Normal file
7
exampleSite/content/pagtest/file1 copy 19.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 2.md
Normal file
7
exampleSite/content/pagtest/file1 copy 2.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 20.md
Normal file
7
exampleSite/content/pagtest/file1 copy 20.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 21.md
Normal file
7
exampleSite/content/pagtest/file1 copy 21.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 22.md
Normal file
7
exampleSite/content/pagtest/file1 copy 22.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 23.md
Normal file
7
exampleSite/content/pagtest/file1 copy 23.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 24.md
Normal file
7
exampleSite/content/pagtest/file1 copy 24.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 25.md
Normal file
7
exampleSite/content/pagtest/file1 copy 25.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 26.md
Normal file
7
exampleSite/content/pagtest/file1 copy 26.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 27.md
Normal file
7
exampleSite/content/pagtest/file1 copy 27.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 28.md
Normal file
7
exampleSite/content/pagtest/file1 copy 28.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 3.md
Normal file
7
exampleSite/content/pagtest/file1 copy 3.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 4.md
Normal file
7
exampleSite/content/pagtest/file1 copy 4.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 5.md
Normal file
7
exampleSite/content/pagtest/file1 copy 5.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 6.md
Normal file
7
exampleSite/content/pagtest/file1 copy 6.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 7.md
Normal file
7
exampleSite/content/pagtest/file1 copy 7.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 8.md
Normal file
7
exampleSite/content/pagtest/file1 copy 8.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy 9.md
Normal file
7
exampleSite/content/pagtest/file1 copy 9.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1 copy.md
Normal file
7
exampleSite/content/pagtest/file1 copy.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
7
exampleSite/content/pagtest/file1.md
Normal file
7
exampleSite/content/pagtest/file1.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: "Charts"
|
||||
date: 2019-03-06
|
||||
summary: "Blowfish includes Chart.js for powerful charts and data visualisations."
|
||||
tags: ["chart", "sample", "graph", "shortcodes"]
|
||||
showDate: false
|
||||
---
|
|
@ -227,7 +227,6 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "pagination.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
|
@ -237,4 +236,8 @@
|
|||
</p>
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "pagination.html" . }}
|
||||
|
||||
{{ end }}
|
||||
|
|
@ -1,39 +1,49 @@
|
|||
{{ $paginator := .Paginator }}
|
||||
{{ if gt $paginator.TotalPages 1 }}
|
||||
<ul class="flex flex-row mt-8">
|
||||
{{ if $paginator.HasPrev }}
|
||||
<li>
|
||||
<a
|
||||
href="{{ $paginator.Prev.URL }}"
|
||||
{{- if gt .Paginator.TotalPages 1 -}}
|
||||
<ul class="flex flex-row mt-8 justify-center">
|
||||
{{- .Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{ if $.Paginator.HasPrev }}
|
||||
<li>
|
||||
<a
|
||||
href="{{ $.Paginator.Prev.URL }}"
|
||||
class="mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral"
|
||||
rel="prev"
|
||||
>
|
||||
←
|
||||
</a>
|
||||
</li>
|
||||
>←</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ range $paginator.Pagers }}
|
||||
<li>
|
||||
<a
|
||||
href="{{ .URL }}"
|
||||
class="{{ if eq . $paginator }}
|
||||
bg-primary-200 dark:bg-primary-400 dark:text-neutral-800
|
||||
{{ end }} mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral"
|
||||
>
|
||||
{{ .PageNumber }}
|
||||
</a>
|
||||
{{- range $.Paginator.Pagers -}}
|
||||
{{- $right := sub .TotalPages .PageNumber -}}
|
||||
{{- $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
|
||||
{{- $showNumber := or $showNumber (and (gt .PageNumber (sub $.Paginator.PageNumber 3)) (lt .PageNumber (add $.Paginator.PageNumber 3))) -}}
|
||||
{{- if $showNumber -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" false -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" false -}}
|
||||
{{- else -}}
|
||||
{{- $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
|
||||
{{- $.Scratch.Set "paginator.ellipsed" true -}}
|
||||
{{- end -}}
|
||||
{{- if $showNumber -}}
|
||||
<li>
|
||||
<a
|
||||
href="{{ .URL }}"
|
||||
class="{{ if eq . $.Paginator }}
|
||||
bg-primary-200 dark:bg-primary-400 dark:text-neutral-800
|
||||
{{ end }} mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral"
|
||||
>{{ .PageNumber }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if $paginator.HasNext }}
|
||||
<li>
|
||||
<a
|
||||
href="{{ $paginator.Next.URL }}"
|
||||
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
|
||||
<li class="page-item ">
|
||||
<span class="page-link" aria-hidden="true">…</span>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ if $.Paginator.HasNext }}
|
||||
<li>
|
||||
<a
|
||||
href="{{ $.Paginator.Next.URL }}"
|
||||
class="mx-1 block min-w-[1.8rem] rounded text-center hover:bg-primary-600 hover:text-neutral"
|
||||
rel="next"
|
||||
>
|
||||
→
|
||||
</a>
|
||||
</li>
|
||||
>→</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{- end -}}
|
Loading…
Reference in a new issue