diff options
| -rw-r--r-- | haunt.scm | 2 | ||||
| -rw-r--r-- | website/builders/replicant-blog-search.scm | 45 |
2 files changed, 8 insertions, 39 deletions
@@ -31,7 +31,7 @@ #:posts-directory "markdown" #:readers (list wordpress-markdown-reader) #:builders (list (replicant-blog-website) - (replicant-blog-search-page) + replicant-blog-search-page (static-directory "static") ;;;;;;;;;;; ;; Feeds ;; diff --git a/website/builders/replicant-blog-search.scm b/website/builders/replicant-blog-search.scm index dfbf4c8..1d71cd4 100644 --- a/website/builders/replicant-blog-search.scm +++ b/website/builders/replicant-blog-search.scm @@ -24,6 +24,7 @@ #:use-module (haunt artifact) #:use-module (haunt builder assets) #:use-module (haunt html) + #:use-module (haunt page) #:use-module (haunt post) #:use-module (haunt site) #:use-module (haunt utils) @@ -41,11 +42,7 @@ (@ (href ,(string-append "https://packages.guix.gnu.org/packages/" name))) ,name)) -(define (replicant-blog-search-template site title posts prefix) - (define (post-uri post) - (string-append (or prefix "") "/" - (site-post-slug site post) ".html")) - +(define replicant-blog-search-page-content `((h1 (@ (id "title")) "Search") (p "This blog has no built-in search functionality. Instead users are @@ -71,36 +68,8 @@ 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-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 -decorated by THEME, whose URLs start with PREFIX." - (define (make-file-name base-name) - (if prefix - (string-append prefix "/" base-name) - 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) - (serialized-artifact (make-file-name file-name) - (render-collection theme site title (filter posts) prefix) - sxml->html)))) - - (append (map post->page posts) - (map collection->page collections)))) +(define (replicant-blog-search-page site posts) + (make-page + "search.html" + (replicant-layout site "Blog: Search" replicant-blog-search-page-content) + sxml->html)) |
