summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-02-05 17:43:29 -0500
committerDavid Thompson <dthompson2@worcester.edu>2022-02-05 17:43:29 -0500
commit073e3a4f11d6987774b44aac1649197dfcacae1b (patch)
treec4946fcf35bd5c8f856bd970dbb7f84fbf911b47
parent738527623d6ecacf6a384525e17e56bde7265fc9 (diff)
Add pagination.
-rw-r--r--css/dthompson.css14
-rw-r--r--haunt.scm3
-rw-r--r--theme.scm15
3 files changed, 30 insertions, 2 deletions
diff --git a/css/dthompson.css b/css/dthompson.css
index b47f092..096d1e3 100644
--- a/css/dthompson.css
+++ b/css/dthompson.css
@@ -204,6 +204,20 @@ footer {
margin-right: 4rem;
}
+/* Pagination */
+
+.paginator {
+ display: flex;
+}
+
+.paginator-spacer {
+ flex: 1;
+}
+
+.paginator-next {
+ text-align: right;
+}
+
/* Syntax Highlighting */
.syntax-special, .syntax-element {
diff --git a/haunt.scm b/haunt.scm
index ed2b788..98f6dc1 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -64,7 +64,8 @@ organic gardener, woodworker, and drummer.")
'((author . "David Thompson")
(email . "davet@gnu.org"))
#:readers (list commonmark-reader*)
- #:builders (list (blog #:theme dthompson-theme #:collections %collections)
+ #:builders (list (blog #:theme dthompson-theme #:collections %collections
+ #:posts-per-page 10)
(atom-feed)
(atom-feeds-by-tag)
about-page
diff --git a/theme.scm b/theme.scm
index 0a81d40..dcae710 100644
--- a/theme.scm
+++ b/theme.scm
@@ -116,7 +116,20 @@ free culture works available under the " ,%cc-by-sa-link " license.")
(div (@ (class "post"))
,(first-paragraph post))
(a (@ (href ,uri)) "read more ➔"))))
- posts)))))
+ posts)))
+ #:pagination-template
+ (lambda (site body previous-page next-page)
+ `(,@body
+ (div (@ (class "paginator"))
+ ,(if previous-page
+ `(a (@ (class "paginator-prev") (href ,previous-page))
+ "🡐 Newer")
+ '())
+ (span (@ (class "paginator-spacer")))
+ ,(if next-page
+ `(a (@ (class "paginator-next") (href ,next-page))
+ "Older 🡒")
+ '()))))))
(define (static-page title file-name body)
(lambda (site posts)