diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 53e610c5..a6ac57d9 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -84,57 +84,80 @@ (join "" (map host/blog--render-node (rest tree)))) (else (host/blog--render-node tree)))) (str "
(empty post)
"))))) +;; ── page shell ────────────────────────────────────────────────────── +;; A page is an SX element tree, rendered via render-page (5.1). The handler +;; builds the tree (running any dynamic logic in the full evaluator, e.g. a posts +;; loop) and render-page renders the static result — no embedded HTML strings, +;; only the doctype prefix render-to-html doesn't emit. `body` is an SX node. (define host/blog--page (fn (title body) - (str "No published post: " slug "
")))))))) + (quasiquote + (div (h1 "404") + (p (unquote (str "No published post: " slug)))))))))))) -(define host/blog--li - (fn (acc p) - (str acc "No posts yet.
") - "")))))) + (let ((items + (map + (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + posts))) + (let ((listing (if (> (len posts) 0) + (list (quote ul) items) + (quote (p "No posts yet."))))) + (dream-html + (host/blog--page "Blog" + (quasiquote + (div (h1 "Posts") + (unquote listing) + (p (a :href "/new" "+ New post"))))))))))) (define host/blog-index (fn (req) (host/ok (host/blog-list)))) -;; ── create page (GET /new) — clean minimal form ──────────────────── -;; A plain create form: title + sx_content (SX element markup) + status. No -;; legacy JS editor, no external assets, no shims. The rich WYSIWYG is a future -;; native SX-island editor served via the Phase-5.2 SSR pipeline (render-page -;; alone can't render dynamic-logic component bodies — proven). Posts to /new. +;; ── create page (GET /new) — clean minimal form as an SX tree ─────── +;; No legacy JS editor, no external assets, no shims. The rich WYSIWYG is a +;; future native SX-island editor (Phase 5.2+). Posts to /new. (define host/blog-new-form (fn (req) (dream-html (host/blog--page "New post" - (str - "