summaryrefslogtreecommitdiff
path: root/jakob/builder/index.scm
blob: a811425329fbf290254f79bbcc5879419c711213 (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
64
65
66
67
68
69
70
71
72
;;; Copyright © 2019 - 2026 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/>.

(define-module (jakob builder index)
  #:use-module (haunt artifact)
  #:use-module (haunt html)
  #:use-module (jakob builder blog)
  #:use-module (jakob theme)
  #:use-module (jakob utils org-mode)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-11)
  #:export (index))

(define about-me-section
  `(section (@ (id "about-me"))
      (h2 (@ (class "section-header")) "About Me")
      ,@(let-values (((_ sxml) (read-org-mode-file "pages/about.org")))
          sxml)))

(define about-site-section
  `(section (@ (id "about-site"))
      (h2 (@ (class "section-header")) "About This Website")
      ,@(let-values (((_ sxml) (read-org-mode-file "pages/about-site.org")))
          sxml)))

(define selected-works-section
  `(section (@ (id "selected-works"))
      (h2 (@ (class "section-header")) "Selected Works")
      (p "Click a thumbnail to view project details.")
      (div (@ (class "project-grid") (role "list"))
           ,(map (lambda (i)
                   `(a (@ (href "/projects/index.html")
                          (class "project-thumb")
                          (role "listitem") )
                       ,(format #f "[ PROJECT ~a ]" i)))
                   (iota 6)))))
           
(define (posts-section posts)
  `((h2 (@ (class "section-header")) "Recent Articles")
    ,@(map render-preview posts)))

(define (index)
  "Return a Haunt build procedure to create an index page."
  (lambda (site posts)
    `(,(serialized-artifact "index.html"
          (theme ;; #:title (post-ref post 'title)
                 ;; #:description (description-from-post post)
                 ;; #:keywords (post-ref post 'tags)
                 ;; #:meta (if (not (eof-object? meta-tags)) meta-tags '())
                 ;; #:scripts (if (not (eof-object? scripts)) scripts '())
           #:content `(,about-me-section
                       (hr (@ (aria-hidden "true")))
                       ,(posts-section (take (sort-posts posts) 3))
                       (hr (@ (aria-hidden "true")))
                       ,selected-works-section
                       (hr (@ (aria-hidden "true")))
                       ,about-site-section
                       ))
          sxml->html))))