aboutsummaryrefslogtreecommitdiffstats
path: root/website
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2024-05-10 17:02:14 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2025-06-15 01:30:29 +0200
commit0a34848fee0f124aecc9f4b969f608157a67d147 (patch)
treeaa0a9cb3ce52e8e48431ad3c6e5f7eec4bcae167 /website
parentbc589297ef80837fe4ceb6c155bed3c515c7d8df (diff)
downloadhaunt-blog-0a34848fee0f124aecc9f4b969f608157a67d147.tar.gz
haunt-blog-0a34848fee0f124aecc9f4b969f608157a67d147.tar.bz2
haunt-blog-0a34848fee0f124aecc9f4b969f608157a67d147.zip
search: repair page.
The search page is based on the website/builders/replicant-blog.scm page, and I started from there and tried to minimize the amount of code added to avoid duplication between the two pages. During that process, for some reasons my browser showed an old version of the page, and so I kept removing code and didn't see when it reverted to listing the articles. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'website')
-rw-r--r--website/builders/replicant-blog-search.scm20
-rw-r--r--website/builders/replicant-blog.scm4
2 files changed, 20 insertions, 4 deletions
diff --git a/website/builders/replicant-blog-search.scm b/website/builders/replicant-blog-search.scm
index d19607a..dfbf4c8 100644
--- a/website/builders/replicant-blog-search.scm
+++ b/website/builders/replicant-blog-search.scm
@@ -41,7 +41,7 @@
(@ (href ,(string-append "https://packages.guix.gnu.org/packages/" name)))
,name))
-(define (replicant-default-collection-template site title posts prefix)
+(define (replicant-blog-search-template site title posts prefix)
(define (post-uri post)
(string-append (or prefix "") "/"
(site-post-slug site post) ".html"))
@@ -71,7 +71,13 @@ FOSDEM in the blog articles, you can use the following commands:")
"\"Full text\" search as by default these file managers usually only "
"search the file names only."))))
-(define* (replicant-blog-search-page #:key (theme replicant-theme) prefix
+(define replicant-blog-search-theme
+ (theme #:name "Replicant"
+ #:layout replicant-layout
+ #:post-template replicant-default-post-template
+ #:collection-template replicant-blog-search-template))
+
+(define* (replicant-blog-search-page #:key (theme replicant-blog-search-theme) prefix
(collections
`(("" "search.html" ,posts/reverse-chronological))))
"Return a procedure that transforms a list of posts into pages
@@ -82,6 +88,13 @@ decorated by THEME, whose URLs start with PREFIX."
base-name))
(lambda (site posts)
+ (define (post->page post)
+ (let ((base-name (string-append (site-post-slug site post)
+ ".html")))
+ (serialized-artifact (make-file-name base-name)
+ (render-post theme site post)
+ sxml->html)))
+
(define collection->page
(match-lambda
((title file-name filter)
@@ -89,4 +102,5 @@ decorated by THEME, whose URLs start with PREFIX."
(render-collection theme site title (filter posts) prefix)
sxml->html))))
- (append (map collection->page collections))))
+ (append (map post->page posts)
+ (map collection->page collections))))
diff --git a/website/builders/replicant-blog.scm b/website/builders/replicant-blog.scm
index b3a8af3..838c27c 100644
--- a/website/builders/replicant-blog.scm
+++ b/website/builders/replicant-blog.scm
@@ -1,6 +1,6 @@
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
-;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2023-2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;;
;;; This file is based on haunt/builder/blog.scm,
;;; haunt/reader/commonmark.scm and tests/post.scm and from Haunt
@@ -34,7 +34,9 @@
#:export (theme-collection-template)
#:export (make-theme)
#:export (render-collection)
+ #:export (render-post)
#:export (replicant-blog-website)
+ #:export (replicant-default-post-template)
#:export (replicant-layout)
#:export (replicant-theme)
#:export (theme)