diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-13 19:45:17 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-13 19:45:17 -0500 |
| commit | 685e88a7bab401e685210f95fa73598e40dd234b (patch) | |
| tree | e6c030ce8fc822a0e32fd5d98449ba9897e021b5 /jakob/builder | |
| parent | 3ff45ef59e1a2898c90ddea8945cd694537a8a3a (diff) | |
Initial update to blog format
Diffstat (limited to 'jakob/builder')
| -rw-r--r-- | jakob/builder/blog.scm | 101 | ||||
| -rw-r--r-- | jakob/builder/blogroll.scm | 2 |
2 files changed, 58 insertions, 45 deletions
diff --git a/jakob/builder/blog.scm b/jakob/builder/blog.scm index 003f96c..c14cecf 100644 --- a/jakob/builder/blog.scm +++ b/jakob/builder/blog.scm @@ -53,11 +53,13 @@ (define (render-article post) "Return the SHTML for POST's contents." - #<(main - (h1 ,(post-ref post 'title)) - (p ,(date->string (post-date post) "~B ~d, ~Y") - " ❖ " - "Tags: " + #<(article (@ (class "update-entry")) + (h1 (@ (class "section-header")) + ,(format #f "Blog :: ~a" (post-ref post 'title))) + (div (@ (class "date-stamp")) + (time (@ (datetime ,(date->string (post-date post) "~Y-~m-~d"))) + ,(date->string (post-date post) "~B ~d, ~Y")) + " » Tagged: " ,@(intersperse (map (lambda (tag) (hyperlink (tag-uri %tag-prefix tag) tag)) @@ -69,47 +71,55 @@ "To read the full post, visit " ,(hyperlink (post-ref post 'crosspost) "this link") ".")) - (div (@ (data-pagefind-body #t)) - (article ,(post-sxml post)) - (section - (@ (id "webmention")) - (h2 "Comments for this page") - (ul (@ (class "webmention-container")) - ,@(render-comment-view (fetch-comments (post-identifier post)) (fetch-webmentions (post-identifier post)))) - (div (@ (id "comment-form-primary") (hidden #t)) - ,(render-dynamic-comment-form (post-identifier post))) - (p (@ (id "comment-form-alt")) - "Click " ,(hyperlink (build-comment-url post) "here") " to write a comment on this post.") - (form - (@ (id "webmention-form") - (action "https://webmention.io/jakob.space/webmention") - (method "post")) - (label "Or, if you've written about this " - ,(hyperlink "https://indieweb.org/responses" "elsewhere") - ", you can send me a Webmention:") - (div (@ (id "webmention-input-group")) - (input (@ (name "source") (type "url") (placeholder "https://..."))) - (input (@ (value "Send") (type "submit"))))) - ,(script "section-folds.js") - ,(script "comment-reaction.js"))))) + ,(post-sxml post))) (define (render-preview post) "Return the SHTML for a preview of POST." (let ((crosspost-uri (post-ref post 'crosspost)) (local-uri (post-uri post))) - #<(section - (h2 ,(hyperlink (or crosspost-uri local-uri) (post-ref post 'title))) - (p ,(date->string (post-date post) "~B ~d, ~Y") - ,(when crosspost-uri - (list " ↻ " (hyperlink local-uri "Crosspost"))) - " ❖ Tags: " - ,@(intersperse - (map (lambda (tag) - (hyperlink (tag-uri %tag-prefix tag) tag)) - (post-ref post 'tags)) - ", ")) - ,(first-paragraph post) - (p ,(hyperlink (or crosspost-uri local-uri) "read more →"))))) + #<(article (@ (class "update-entry")) + (header + (div (@ (class "date-stamp")) + (time (@ (datetime ,(date->string (post-date post) "~Y-~m-~d"))) + ,(date->string (post-date post) "~B ~d, ~Y")) + " » Tagged: " + ,@(intersperse + (map (lambda (tag) + (hyperlink (tag-uri %tag-prefix tag) tag)) + (post-ref post 'tags)) + ", ")) + (h3 (@ (class "title")) + ,(hyperlink (or crosspost-uri local-uri) (post-ref post 'title)))) + ;; TODO: Handle crossposts. + ;; (p + ;; ,(when crosspost-uri + ;; (list " ↻ " (hyperlink local-uri "Crosspost"))) + ;; " ❖ Tags: " + ;; ) + ,(first-paragraph post) + (p ,(hyperlink (or crosspost-uri local-uri) "read more →"))))) + +;; TODO: Should dynamically pull comments. +(define (comments-section post) + `(section (@ (class "comments-section") + (aria-labelledby "comments-heading")) + (h3 (@ (id "comments-heading") + (class "module-title")) + ;; TODO: Need dynamiccount of comments + "Comments (2)") + (div (@ (class "comment-form-module")) + (h4 (@ (class "module-title")) + "Leave a Comment") + (form (@ (class "comment-form")) + (div (@ (class "form-row")) + (input (@ (type "text") (placeholder "Name") (required "") (aria-label "Name"))) + (input (@ (type "text") (placeholder "Subject (Optional)") (aria-label "Subject")))) + (div (@ (class "form-row")) + (input (@ (type "url") (placeholder "Website (https://...)") (aria-label "Website URL")))) + (textarea (@ (placeholder "Write your comment here...") + (rows "4") + (required "") + (aria-label "Comment body"))))))) ;;; @@ -141,7 +151,8 @@ #:keywords (post-ref post 'tags) #:meta (if (not (eof-object? meta-tags)) meta-tags '()) #:scripts (if (not (eof-object? scripts)) scripts '()) - #:content (render-article post)) + #:content `(,(render-article post) + ,(comments-section post))) sxml->html)) @@ -149,8 +160,10 @@ ;;; Navigation based on post tags. ;;; +(define %blog-prefix "/blog") + ;; Subdirectory for post listings conditioned on post tags. -(define %tag-prefix "/blog/tag") +(define %tag-prefix (string-append %blog-prefix "/tag")) (define (tags->pages posts) "Return a list of pages for each tag used in POSTS, with said pages containing @@ -193,7 +206,7 @@ of the 'post' objects associated with the site." ;; Main post navigation. (items->pages render-preview (posts/reverse-chronological posts) - "Recent Posts" "index" + "Blog" (string-append %blog-prefix "/index") #:enable-search #t) ;; Tag-based navigation. diff --git a/jakob/builder/blogroll.scm b/jakob/builder/blogroll.scm index 59ce221..fea04e2 100644 --- a/jakob/builder/blogroll.scm +++ b/jakob/builder/blogroll.scm @@ -85,7 +85,7 @@ each tag is used." "Return an SHTML document listing ENTRIES in PREFIX, with a header of TITLE." #<(main (h1 ,(if tag - (format #f "~a - Tagged with \"~a\"" title tag) + (format #f "~a :: Tagged \"~a\"" title tag) title)) ,(unless tag (render-tag-cloud prefix entries)) ,(unless tag `(hr)) |