summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2026-02-13 19:45:17 -0500
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2026-02-13 19:45:17 -0500
commit685e88a7bab401e685210f95fa73598e40dd234b (patch)
treee6c030ce8fc822a0e32fd5d98449ba9897e021b5
parent3ff45ef59e1a2898c90ddea8945cd694537a8a3a (diff)
Initial update to blog format
-rw-r--r--jakob/builder/blog.scm101
-rw-r--r--jakob/builder/blogroll.scm2
-rw-r--r--jakob/theme.scm29
-rw-r--r--jakob/utils/pagination.scm4
4 files changed, 75 insertions, 61 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))
diff --git a/jakob/theme.scm b/jakob/theme.scm
index a3e3019..439b066 100644
--- a/jakob/theme.scm
+++ b/jakob/theme.scm
@@ -135,19 +135,16 @@
(a (@ (href "/blog/usb-pd-is-pretty-cool.html#comment-reply"))
"This is a lifesaver for field work. Have you..."))))))
-(define* (sidebar #:optional modules)
- )
-
(define %footer
- (define year (date-year (current-date)))
- `(footer (@ (class "site-footer"))
- (img (@ (src "/static/image/cc-by-sa-4.0.png")
- (alt "Creative Commons BY-SA 4.0")))
- "©"
- (time (@ (datetime "2015")) "2015")
- " - "
- (time (@ (datetime ,year)) ,year)/
- " Jakob L. Kreuze"))
+ (let ((year (date-year (current-date))))
+ `(footer (@ (class "site-footer"))
+ (img (@ (src "/static/image/cc-by-sa-4.0.png")
+ (alt "Creative Commons BY-SA 4.0")))
+ "©"
+ (time (@ (datetime "2015")) "2015")
+ " - "
+ (time (@ (datetime ,year)) ,year)/
+ " Jakob L. Kreuze")))
(define* (theme #:key
(title '())
@@ -156,7 +153,7 @@
(meta '())
(scripts '())
(content '(div ""))
- (sidebar '()))
+ (sidebar #f))
"Return an SHTML document using the website's theme."
`((doctype "html")
(html
@@ -199,6 +196,10 @@
(aside (@ (class "sidebar"))
,@(or sidebar %default-sidebar-modules))
(main (@ (class "main-content"))
- ,content)
+ ,(if (and (list? content)
+ (positive? (length content))
+ (symbol? (first content)))
+ `(,content)
+ content))
,@scripts)
,%footer)))))
diff --git a/jakob/utils/pagination.scm b/jakob/utils/pagination.scm
index 9e7bd47..9e6ff13 100644
--- a/jakob/utils/pagination.scm
+++ b/jakob/utils/pagination.scm
@@ -63,7 +63,7 @@ lists of the form (index, items)."
#:key enable-search)
"Return an SHTML document showing CONTENT, with the header TITLE and links to
PREVIOUS-PAGE and NEXT-PAGE."
- #<((h1 ,title)
+ #<((h2 (@ (class "section-header")) ,title)
,@(if enable-search
'((div (@ (id "search"))))
'())
@@ -106,7 +106,7 @@ the item from ITEMS passed as a parameter."
((index subset)
(let ((title (if (= index 1)
base-title
- (format #f "~a — Page ~a" base-title index)))
+ (format #f "~a :: Page ~a" base-title index)))
(previous-page (if (>= (1- index) 1)
(index->file-name (1- index))
#f))