aboutsummaryrefslogtreecommitdiffstats
path: root/modules/builders/replicant-blog-search.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/builders/replicant-blog-search.scm')
-rw-r--r--modules/builders/replicant-blog-search.scm75
1 files changed, 75 insertions, 0 deletions
diff --git a/modules/builders/replicant-blog-search.scm b/modules/builders/replicant-blog-search.scm
new file mode 100644
index 0000000..694e3b5
--- /dev/null
+++ b/modules/builders/replicant-blog-search.scm
@@ -0,0 +1,75 @@
+;;; Copyright © 2015 David Thompson <davet@gnu.org>
+;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.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
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (modules 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 (modules 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))