aboutsummaryrefslogtreecommitdiff
path: root/haunt/jakob/builder
diff options
context:
space:
mode:
authorJakob L. Kreuze2023-02-12 14:50:42 -0500
committerJakob L. Kreuze2023-02-12 14:50:42 -0500
commit4b8de0bcf0ca598804a9d462933d492232b4b314 (patch)
treec0dc84333273faa56915f90b27865b2374679de4 /haunt/jakob/builder
parent8e2abe9549360f37f6703bd995b8278e4fb6b291 (diff)
Merge branch 'self-hosted-comments'
It's been working well enough. I think it's time to get the initial version of this on `master'.
Diffstat (limited to 'haunt/jakob/builder')
-rw-r--r--haunt/jakob/builder/blog.scm41
1 files changed, 16 insertions, 25 deletions
diff --git a/haunt/jakob/builder/blog.scm b/haunt/jakob/builder/blog.scm
index c9b01c8..de1c788 100644
--- a/haunt/jakob/builder/blog.scm
+++ b/haunt/jakob/builder/blog.scm
@@ -21,12 +21,13 @@
#:use-module (haunt utils)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
+ #:use-module (jakob dynamic capabilities comment-form)
#:use-module (jakob theme)
#:use-module (jakob utils)
#:use-module (jakob utils pagination)
#:use-module (jakob utils sxml)
#:use-module (jakob utils tags)
- #:use-module (jakob utils webmention)
+ #:use-module (jakob utils comments)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
@@ -47,19 +48,8 @@
;;; Rendering.
;;;
-(define (build-anonymous-comment-url post)
- (let* ((target (format #f "http://jakob.space~a" (post-uri post)))
- (params `(("dontask" . "1")
- ("me" . "https://commentpara.de")
- ("reply" . ,target)))
- (query (string-join (map (lambda (pair)
- (string-concatenate
- (list (uri-encode (car pair))
- "="
- (uri-encode (cdr pair)))))
- params)
- "&")))
- (format #f "https://quill.p3k.io/?~a" query)))
+(define (build-comment-url post)
+ (format #f "/api/comment-form/~a" (post-slug post)))
(define (render-article post)
"Return the SHTML for POST's contents."
@@ -82,21 +72,22 @@
(article ,(post-sxml post))
(section
(@ (id "webmention"))
- (h2 ,(hyperlink "https://indieweb.org/Webmention" "Webmentions")
- " for this Page")
- (ul (@ (id "webmention-container"))
- ,@(render-comment-view (fetch-webmentions (post-identifier post))))
+ (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
- (@ (action "https://webmention.io/jakob.space/webmention")
+ (@ (id "webmention-form")
+ (action "https://webmention.io/jakob.space/webmention")
(method "post"))
- (label "Have you written a "
- ,(hyperlink "https://indieweb.org/responses" "response")
- " to this? Let me know the URL:")
+ (label "Alternatively, if you've written about this "
+ ,(hyperlink "https://indieweb.org/responses" "elsewhere")
+ ", you can let me know the URL:")
(input (@ (name "source") (type "url")))
(input (@ (value "Send Webmention") (type "submit"))))
- (p "Alternatively, you can send an "
- ,(hyperlink (build-anonymous-comment-url post) "anonymous comment")
- ".")
,(script "section-folds.js")
;; ,(script "webmention.js")
)))

© 2015 - 2026 Jakob L. Kreuze