From 47e643a9ee6fa1c0bc31465ea15cadf1c267b7c0 Mon Sep 17 00:00:00 2001 From: Spenser Truex Date: Sat, 11 May 2024 03:08:44 -0400 Subject: [PATCH] Unmagic the number 10 for index posts --- src/indexes.lisp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/indexes.lisp b/src/indexes.lisp index 7faff31..844e48c 100644 --- a/src/indexes.lisp +++ b/src/indexes.lisp @@ -5,6 +5,9 @@ (defvar *all-tags* nil "The list of tags which content has been tagged with.") +(defvar *pages-listings-on-index* 10 + "Page listings in the index per page.") + (defclass index () ((url :initarg :url :reader page-url) (name :initarg :name :reader index-name) @@ -67,14 +70,14 @@ (defmethod discover ((doc-type (eql (find-class 'numeric-index)))) (let ((content (by-date (find-all 'post)))) - (dotimes (i (ceiling (length content) 10)) + (dotimes (i (ceiling (length content) *pages-listings-on-index*)) (add-document (index-by-n i content))))) (defun index-by-n (i content) "Return the index for the Ith page of CONTENT in reverse chronological order." - (let ((content (subseq content (* 10 i)))) + (let ((content (subseq content (* *pages-listings-on-index* i)))) (make-instance 'numeric-index :slug (1+ i) :name (1+ i) - :content (take-up-to 10 content) + :content (take-up-to *pages-listings-on-index* content) :title "Recent Content"))) (defmethod publish ((doc-type (eql (find-class 'numeric-index))))