summaryrefslogtreecommitdiff
path: root/haunt.scm
blob: 3ec517a38f2d533feb948a624d00d1c6a3118418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;;; Copyright © 2019 - 2020 Jakob L. Kreuze <zerodaysfordays@sdf.org>
;;;
;;; This program 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.
;;;
;;; This program 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 this program. If not, see
;;; <http://www.gnu.org/licenses/>.

(use-modules (haunt builder assets)
             (haunt post)
             (haunt reader)
             (haunt site)
             (jakob builder atom)
             (jakob builder blog)
             (jakob builder blogroll)
             (jakob builder flat-pages)
             (jakob builder htaccess)
             (jakob builder outbox)
             (jakob reader html-prime)
             (jakob reader org-mode-prime)
             (jakob theme)
             (srfi srfi-19)
             (srfi srfi-26))

;; Replace Haunt's default 'string->date* function with one that recognizes the
;; date format that Org uses.
(define (org-string->date str)
  "Convert STR, a string in Org format, into a SRFI-19 date object."
  (catch 'misc-error
    (lambda () (string->date str "<~Y-~m-~d ~a ~H:~M>"))
    (lambda (key . parameters) (string->date str "<~Y-~m-~d ~a>"))))

(register-metadata-parser! 'date org-string->date)

(site #:title "Jakob's Personal Webpage"
      #:domain "jakob.space"
      #:default-metadata
      '((author . "Jakob L. Kreuze")
        (email  . "zerodaysfordays@sdf.lonestar.org"))
      #:make-slug post-slug-v2
      #:readers (list html-reader-prime org-mode-reader-prime sxml-reader)
      #:builders
      (list (atom-feed #:max-entries 1024)
            (blog)
            (blogroll)
            (outbox)
            (flat-pages "pages"
                        #:template (lambda (_site title content)
                                     (let ((content `(div (@ (data-pagefind-body #t))
                                                          ,@content)))
                                       (theme #:title title #:content content)))
                        #:prefix "pages/")
            (static-directory "static")
            (static-directory "posts-assets" "blog")
            (static-directory "pages-assets" "pages")))