X-Git-Url: https://git.shemshak.org/~bandali/bndl.org/blobdiff_plain/cfff0eef996c14198888ad9b58ab1e2d2c058b80..60a33c6fd471a16ac68a3f767b59def05f2f9832:/haunt.scm diff --git a/haunt.scm b/haunt.scm index 03af1aa..7948659 100644 --- a/haunt.scm +++ b/haunt.scm @@ -137,34 +137,38 @@ resulting list is of an odd length and every second element is DELIM." "https://man.sr.ht/lists.sr.ht/etiquette.md") "]") "."))) +(define* (post-uri site post #:optional prefix) + (string-append (or prefix "") "/" + (site-post-slug site post) ".html")) + +(define* (post-list-table site posts #:optional prefix) + `((table + (@ (class "post-list")) + (tbody + ,@(map + (lambda (post) + `(tr + (td ,(aa (post-ref post 'title) + (post-uri site post prefix))) + (td (small ,(date->string (post-date post) + my-date-format))))) + posts))))) + (define* (my-collection-template site title posts prefix #:optional all-posts tag) - (define (post-uri post) - (string-append (or prefix "") "/" - (site-post-slug site post) ".html")) - `((h2 ,title ,(if tag - (aa `(img (@ (class "feed-icon") - (src "/feed.svg") + (aa `(img (@ (class "feed-icon-h2") + (src "/icon-16px.png") (alt "subscribe to atom feed"))) (tag-uri my-tag-prefix tag ".xml")) '())) - (table - (@ (class "post-list")) - (tbody - ,@(map (lambda (post) - `(tr - (td ,(aa (post-ref post 'title) (post-uri post))) - (td (@ (style "font-size: 0.875em;")) - ,(date->string (post-date post) - my-date-format)))) - posts))) + ,(post-list-table site posts prefix) (h2 "Tags") ,(tag-links (or all-posts posts)) ,(if tag '(a (@ (href "/notes.html")) - "← all posts") + "← all notes") '()))) (define bandali-theme @@ -286,21 +290,18 @@ resulting list is of an odd length and every second element is DELIM." "images")) (h2 (@ (id "notes")) "Notes") (p "Here are notes about a variety of topics and issues I care " - "about. They’re also available via " ,(aa "Atom" "notes.atom") - " and " ,(aa "RSS" "notes.rss") " feeds.") - (table - (@ (class "post-list")) - (tbody - ,@(map - (lambda (post) - (define (post-uri post) - (string-append "/" - (site-post-slug site post) ".html")) - `(tr - (td ,(aa (post-ref post 'title) (post-uri post))) - (td (small - ,(date->string (post-date post) my-date-format))))) - (take-up-to 10 (posts/reverse-chronological posts))))))) + "about. They’re also available via " + ,(aa `((img (@ (class "feed-icon") + (src "/icon-12px.png") + (alt "subscribe to atom feed"))) + "Atom") + "notes.atom") + " and " + ,(aa `((img (@ (class "feed-icon") + (src "/icon-12px.png") + (alt "subscribe to rss feed"))) + "RSS") "notes.rss") " feeds.") + ,(post-list-table site posts))) (define (index-page site posts) (make-page