commit a4da0f5df70cc5b2e916bdf997c55c7dd09742af
parent 3a1546f29e63d6e4cd6f2b75bc845d725add760b
Author: Decay <decaydjk@tilde.town>
Date: Sat, 8 Feb 2020 20:40:18 +0000
Fixing up generated archival links
Diffstat:
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/content.lisp b/src/content.lisp
@@ -6,12 +6,13 @@
:directory (pathname-directory this-file)
:defaults this-file)))
-(defun make-generator (&optional title)
+(defun make-generator (&optional title root-uri)
(lambda (entries &key year month archive-date-list tz)
(execute-emb
"default-template"
:env (list
:title title
+ :root-uri root-uri
:posts entries
:year year
:month month
diff --git a/src/miniblog.lisp b/src/miniblog.lisp
@@ -34,7 +34,7 @@
(uiop:getenv "USER"))
(defun make-generator (&optional title)
- (setf *generator* (miniblog.content:make-generator title)))
+ (setf *generator* (miniblog.content:make-generator title *root-uri*)))
(defun get-index-file-for-path (path)
(merge-pathnames
@@ -131,7 +131,16 @@
(content (nth 1 post)))
(miniblog.db:update-entry
id title content
- :username (get-username)))
+ :username (get-username))
+ (let* ((created-at (nth 1 entry))
+ (year (timestamp-year created-at
+ :timezone *blog-timezone*))
+ (month (timestamp-month created-at
+ :timezone *blog-timezone*))
+ (entries (miniblog.db:get-entries)))
+ (if (not regen)
+ (regenerate-index-and-given-month entries year month)
+ (regenerate-all entries))))
(format t "No change, abandoning...~%")))))
(defun delete-post (id)
diff --git a/src/template.lhtml b/src/template.lhtml
@@ -72,7 +72,10 @@
(loop for cal-month from (* row 4) to (+ (* row 4) 3) do
(format t "<td>")
(if (nth cal-month month-entries)
- (format t "<a href=\"~a\">~a</a>" (nth cal-month month-entries) (nth cal-month month-names))
+ (format t "<a href=\"~a~a\">~a</a>"
+ (or (getf env :root-uri) "")
+ (nth cal-month month-entries)
+ (nth cal-month month-names))
(format t "~A" (nth cal-month month-names)))
(format t "</td>~%"))
(format t "</tr>~%")))