fix: route / to /index, use cadr for query alist, rename lambda t param

This commit is contained in:
2026-06-20 17:02:57 -04:00
parent 794ef3ffc9
commit 24f24620d3
+7 -4
View File
@@ -165,7 +165,7 @@ Returns nil if the file is missing or cannot be parsed."
(let ((tags (plist-get book :tags)))
(when tags
(insert (format "<span class=\"tags\">%s</span>\n"
(mapconcat (lambda (t) (concat ":" t ":"))
(mapconcat (lambda (tag) (concat ":" tag ":"))
tags " ")))))
;; Recommendation trail
(let ((rec-by (plist-get book :rec_by))
@@ -227,13 +227,16 @@ Set by test harnesses that only need the model functions.")
;; --- handlers ---------------------------------------------------------
(defservlet index text/html ()
(defservlet index text/html (path query request)
(let ((books (spine-books)))
(if books
(insert (spine-render-index books
(ht-get (ht-from-query-string (httpd-query-string)) "id")))
(insert (spine-render-index books (cadr (assoc "id" query))))
(insert (spine-render-empty-state)))))
(defun httpd/ (proc uri-path query request)
"Redirect root to /index."
(httpd-redirect proc "/index" 302))
;; --- start ------------------------------------------------------------
(unless spine-skip-server-start
(setq httpd-host spine-host)