1 (use-modules (haunt asset)
14 (define (stylesheet name)
15 `(link (@ (rel "stylesheet")
16 (href ,(string-append "css/" name ".css")))))
18 (define (static-page title file-name body)
21 (with-layout flex-theme site title body)
24 (define (get-tags post)
25 (or (assoc-ref (post-metadata post) 'tags) '()))
27 (define (post-date-and-tags date tags)
28 (let ((div `(div (@ (class "date-and-tags"))
29 (time (@ (datetime ,(date->string date "~Y-~m-~dT~H:~M:~S")))
30 ,(date->string date "~Y-~m-~d")))))
31 (cond ((> (length tags) 0)
34 (span (@ (style "margin: 0 3px")) ⦿)
35 (span (@ (class "tags"))
40 `((a (@ (href ,(format #f "tags/~a.html" tag))) ,tag) ", "))
49 (lambda (site title body)
53 (meta (@ (charset "utf-8")))
54 (title ,(string-append title " - " (site-title site)))
55 (link (@ (rel "stylesheet") (href "https://fonts.googleapis.com/css?family=Merriweather+Sans:400,300,300italic,400italic,700,700italic,800,800italic|Merriweather:400,300,300italic,400italic,700,700italic,900,900italic|Source+Code+Pro:200,300,400,500,600,700,900")))
56 ,(stylesheet "application.min")
57 ,(stylesheet "pygments.min")
58 ,(stylesheet "custom")
59 (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))))
61 ,(let ((metadata (site-default-metadata site)))
62 `(div (@ (id "page-content"))
64 (nav (@ (role "navigation") (class "navigation-bar"))
65 (ul (@ (class "navigation-items left"))
66 (li (@ (id "blog-title-header"))
67 (a (@ (href "index.html"))
68 (h1 ,(assoc-ref metadata 'author)))))
69 (ul (@ (class "navigation-items center")))
70 (ul (@ (class "navigation-items right"))
72 `(li (a (@ (href ,(cdr page))) ,(car page))))
73 (assoc-ref metadata 'pages)))))
74 (section (@ (role "main"))
75 (div (@ (class "content") (class "col-md-12")) ,body))))))))
79 `((article (@ (class "inline"))
81 (h1 (@ (class "title")) ,(post-ref post 'title))
82 ,(post-date-and-tags (post-date post) (get-tags post)))
86 (lambda (site title posts prefix)
87 (define (post-uri post)
88 (string-append (or prefix "")
89 (site-post-slug site post) ".html"))
91 (define (get-paragraphs sxml count)
92 (define (getp sxml count res)
93 (cond ((or (= count 0) (null? sxml))
95 ((and (pair? (car sxml)) (eq? (caar sxml) 'p))
96 (getp (cdr sxml) (- count 1) (cons (car sxml) res)))
98 (getp (cdr sxml) count (cons (car sxml) res)))))
99 (reverse (getp sxml count '())))
101 (define (post-summary post)
102 (or (post-ref post 'summary)
103 (get-paragraphs (cdar (post-sxml post)) 3)))
106 ,@(map (lambda (post)
107 `(article (@ (class "inline"))
109 (h2 (@ (class "title"))
110 (a (@ (href ,(post-uri post)))
111 ,(post-ref post 'title)))
112 ,(post-date-and-tags (post-date post) (get-tags post)))
114 (footer (@ (class "read-more"))
115 (a (@ (href ,(post-uri post))) "...read more..."))))
116 (posts/reverse-chronological posts))))))
125 `(("Home" "index.html" ,posts/reverse-chronological)))
127 (site #:title "Javier Sancho"
128 #:domain "jsancho.org"
130 '((author . "Javier Sancho")
131 (description . "Free Software Evangelist - Programmer")
132 (email . "jsf@jsancho.org")
133 (picture . "images/jsancho.jpg")
134 (pages . (("projects" . "http://git.jsancho.org/")
135 ("about me" . "about.html"))))
136 #:readers (list sxml-reader html-reader)
137 #:builders (list (blog #:theme flex-theme #:collections %collections)
141 (static-directory "images")
142 (static-directory "fonts")
143 (static-directory "css")))