From 187d98ecc5bd6b35f0421aa5eac905f47c656c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 12 Apr 2021 22:27:30 +0200 Subject: website: Summarize blog posts on the overview page. * website/haunt.scm (summarize-post): New procedure. (post->sxml): Use it. * website/posts/kickoff.md: Move "DRAFT" below. --- haunt.scm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'haunt.scm') diff --git a/haunt.scm b/haunt.scm index c86ed04..a230226 100644 --- a/haunt.scm +++ b/haunt.scm @@ -179,14 +179,20 @@ representation." ;; There's an implicit "/index.html" here. "/" (site-post-slug site post)))) +(define (summarize-post post uri) + (match (post-sxml post) + ((('p paragraph ...) _ ...) + `((p ,@paragraph) + (p (a (@ (href ,uri)) "Continue reading…")))) + (body + body))) + (define* (post->sxml post #:key post-uri summarize?) "Return the SXML for POST." (define post-body* - ;; (if summarize? - ;; (cut summarize-post <> post-uri) - ;; post-sxml*) - post-sxml - ) + (if summarize? + (cut summarize-post <> post-uri) + post-sxml)) `(div (@ (class "post")) (h1 (@ (class "title")) -- cgit v1.2.1