From c509d28afcc2a18ddfdf23877b22ef9947b38b52 Mon Sep 17 00:00:00 2001 From: Xavi Date: Mon, 13 Mar 2023 16:28:48 -0700 Subject: [PATCH] Added pagination --- xavishobbies/config.toml | 1 + .../themes/xavis/layouts/_default/list.html | 4 +- .../xavis/layouts/partials/pagination.html | 40 +++++++++++++++++++ .../themes/xavis/static/css/style.css | 19 +++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 xavishobbies/themes/xavis/layouts/partials/pagination.html diff --git a/xavishobbies/config.toml b/xavishobbies/config.toml index 10dd1db..67ff67c 100644 --- a/xavishobbies/config.toml +++ b/xavishobbies/config.toml @@ -1,5 +1,6 @@ baseURL = 'https://xavishobbies.org/' languageCode = 'en-us' title = 'Xavis Hobbies' +paginate = 5 theme='xavis' diff --git a/xavishobbies/themes/xavis/layouts/_default/list.html b/xavishobbies/themes/xavis/layouts/_default/list.html index 4f65b32..e2a2828 100644 --- a/xavishobbies/themes/xavis/layouts/_default/list.html +++ b/xavishobbies/themes/xavis/layouts/_default/list.html @@ -9,9 +9,10 @@ {{ end }} +{{ $paginator := .Paginate (where .Pages "Params.categories" "intersect" (slice "Top_of_the_Stack")) }}

Tots Posts

- {{ range where .Pages "Params.categories" "intersect" (slice "Top_of_the_Stack") }} + {{ range $paginator.Pages }}

{{ .Title }}

@@ -21,4 +22,5 @@
{{ end }} + {{ partial "pagination.html" . }} {{ end }} diff --git a/xavishobbies/themes/xavis/layouts/partials/pagination.html b/xavishobbies/themes/xavis/layouts/partials/pagination.html new file mode 100644 index 0000000..57f4e68 --- /dev/null +++ b/xavishobbies/themes/xavis/layouts/partials/pagination.html @@ -0,0 +1,40 @@ +{{ $pag := $.Paginator }} +{{ if gt $pag.TotalPages 1 }} + +{{ end }} diff --git a/xavishobbies/themes/xavis/static/css/style.css b/xavishobbies/themes/xavis/static/css/style.css index 2ba941d..9a0361a 100644 --- a/xavishobbies/themes/xavis/static/css/style.css +++ b/xavishobbies/themes/xavis/static/css/style.css @@ -162,6 +162,25 @@ img.resize{ margin-bottom: 0px; } +.pagination{ + font-size:0px; + text-align:center; + padding:15px; +} + +.page-item{ + font-size:15px; + display:inline-block; + border:1px solid #470161; + padding:3px; +} + +.page-item-nav{ + font-size:15px; + display:inline-block; + padding:4px; +} + #ascii_site_heading{ color: #ff00e5; }