;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Christopher Allan Webber ;;; Copyright © 2023-2024 Denis 'GNUtoo' Carikli ;;; ;;; This file is based on haunt/builder/blog.scm, ;;; haunt/reader/commonmark.scm and tests/post.scm and from Haunt ;;; 2.6.0. ;;; ;;; This file is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published ;;; by the Free Software Foundation; either version 3 of the License, ;;; or (at your option) any later version. ;;; ;;; Haunt is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with Haunt. If not, see . (define-module (website builders replicant-blog-search) #:use-module (commonmark) #: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) #:use-module (ice-9 match) #:use-module (ice-9 rdelim) #:use-module (srfi srfi-9) #:use-module (srfi srfi-19) #:use-module (website builders replicant-blog) #:export (replicant-blog-search-page)) (fluid-set! %default-port-encoding "UTF-8") (define (guix-package name) `(a (@ (href ,(string-append "https://packages.guix.gnu.org/packages/" name))) ,name)) (define replicant-blog-search-page-content `((h1 (@ (id "title")) "Search") (p "This blog has no built-in search functionality. Instead users are supposed to download the full blog source code and search inside it. This way they are fully in control of the search and in most cases it should not leak the search to a third party.") (p "Here is an example that works under a terminal in GNU/Linux with git installed:") (p (@ (class "command")) "git clone https://git.replicant.us/contrib/GNUtoo/infrastructure/haunt-blog") (p "And then you can search in it. For instance if you want to search for FOSDEM in the blog articles, you can use the following commands:") (p (@ (class "command")) "cd haunt-blog") (p (@ (class "command")) "git grep -i fosdem -- posts") (p (string-append "It is also possible to download the source code with graphical " "software such as " ,(guix-package "gitg") " and then search inside the files with file managers such as " ,(guix-package "nautilus") ". " "If you want to search inside the files, be sure to select the " "\"Full text\" search as by default these file managers usually only " "search the file names only.")))) (define (replicant-blog-search-page site posts) (make-page "search.html" (replicant-layout site "Blog: Search" replicant-blog-search-page-content) sxml->html))