From 0d0832cab6482c7272e3866a278c6811ad5d50c4 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 13 Nov 2023 10:05:14 -0600 Subject: [PATCH] implement basic pagination --- config/_default/hugo.toml | 2 +- layouts/partials/archive.html | 5 +++-- static/css/custom.css | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index 84767f1..164e5cc 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -2,7 +2,7 @@ baseURL = "https://runtimeterror.dev" theme = "risotto" title = "runtimeterror" copyright = "© 2018-2023 [runtimeterror](https://runtimeterror.dev)" -paginate = 3 +paginate = 10 languageCode = "en" DefaultContentLanguage = "en" enableInlineShortcodes = true diff --git a/layouts/partials/archive.html b/layouts/partials/archive.html index b63bc39..fc7d6bd 100644 --- a/layouts/partials/archive.html +++ b/layouts/partials/archive.html @@ -11,7 +11,7 @@ {{ .Content }} -{{ range $pages }} +{{- range (.Paginate $pages).Pages }} {{- $postDate := .Date.Format "2006-01-02" }} {{- $updateDate := .Lastmod.Format "2006-01-02" }}
@@ -27,4 +27,5 @@
-{{ end }} \ No newline at end of file +{{ end }} +{{- template "_internal/pagination.html" . }} \ No newline at end of file diff --git a/static/css/custom.css b/static/css/custom.css index 729eb86..bf8ea8a 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -156,4 +156,16 @@ body.dark .notice { position: relative; } +/* pagination overrides */ +ul.pagination li::marker { + content:''; +} +ul.pagination li { + margin: 0 0.25rem; +} + +.pagination { + display:flex; + justify-content: center; +}