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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
;;; Haunt --- Static site generator for GNU Guile
;;; Copyright © 2016 David Thompson <davet@gnu.org>
;;;
;;; This file is part of Haunt.
;;;
;;; Haunt 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/>.
(use-modules (haunt site)
(haunt reader)
(haunt reader skribe)
(haunt asset)
(haunt page)
(haunt post)
(haunt html)
(haunt utils)
(haunt builder blog)
(haunt builder atom)
(haunt builder assets)
(srfi srfi-19)
(ice-9 rdelim)
(ice-9 match)
(web uri))
(define %releases
'(("0.2" #t)
("0.1" #f)))
(define (tarball-url version)
(string-append "http://files.dthompson.us/haunt/haunt-"
version ".tar.gz"))
(define (tarball-signature-url version)
(string-append "http://files.dthompson.us/haunt/haunt-"
version ".tar.gz.sig"))
(define %download-button
(match %releases
(((version _) . _)
`(a (@ (class "btn btn-primary btn-lg")
(role "button")
(href ,(tarball-url version)))
"Download Haunt " ,version))))
(define (stylesheet name)
`(link (@ (rel "stylesheet")
(href ,(string-append "/css/" name ".css")))))
(define (anchor content uri)
`(a (@ (href ,uri)) ,content))
(define (logo src)
`(img (@ (class "logo") (src ,(string-append "/images/" src)))))
(define (jumbotron content)
`(div (@ (class "jumbotron"))
(div (@ (class "row"))
(div (@ (class "column-logo"))
(img (@ (class "big-logo")
(src "/images/haunt.png"))))
(div (@ (class "column-info")) ,content))))
(define %cc-by-sa-link
'(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/"))
"Creative Commons Attribution Share-Alike 4.0 International"))
(define %piwik-code
'((script (@ (type "text/javascript") (src "/js/piwik.js")))
(noscript
(p (img (@ (src "//stats.dthompson.us/piwik.php?idsite=3")
(style "border:0;")
(alt "")))))))
(define haunt-theme
(theme #:name "Haunt"
#:layout
(lambda (site title body)
`((doctype "html")
(head
(meta (@ (charset "utf-8")))
(title ,(string-append title " — " (site-title site)))
,(stylesheet "reset")
,(stylesheet "main")
,%piwik-code)
(body
(header (@ (class "navbar"))
(div (@ (class "container"))
(ul
(li ,(anchor "home" "/"))
(li ,(anchor "downloads" "/downloads.html"))
(li ,(anchor "docs" "/manual/index.html"))
(li ,(anchor "git"
"https://git.dthompson.us/haunt.git")))))
(div (@ (class "container"))
,body
(footer (@ (class "text-center"))
(p (small "Copyright © 2016 David Thompson"))
(p
(small "The text and images on this site are free
culture works available under the " ,%cc-by-sa-link " license.")))))))
#:post-template
(lambda (post)
`((h2 ,(post-ref post 'title))
(h3 "by " ,(post-ref post 'author)
" — " ,(date->string* (post-date post)))
(div ,(post-sxml post))))
#:collection-template
(lambda (site title posts prefix)
(define (post-uri post)
(string-append "/" (or prefix "")
(site-post-slug site post) ".html"))
`(,(jumbotron
`((p "Haunt is a simple, functional, hackable static site
generator written in Guile Scheme that gives authors the ability to
treat websites as programs.")
,%download-button))
(p "Haunt isn't your average static site generator. Its
mission is to give authors the full expressive power of Scheme to
define every aspect of their websites are generated. Haunt uses a
simple, functional build system that allows any type of web page to be
built by writing procedures that return page objects.")
(p "Haunt has no opinion about what markup language
authors should use to write posts. Just write the relevant reader
procedure and Haunt will happily work with that format. Likewise,
Haunt has no opinion about how authors structure their sites. Haunt
ships with helpful builder procedures that generate simple blogs or
Atom feeds, but authors should feel empowered to tweak them, write
replacements, or add new builders to do things that the Haunt hackers
didn't think of.")
(p "Here's what a simple Haunt configuration looks
like:")
(pre
,(call-with-input-file "../example/haunt.scm" read-string))
(p "With the above saved into a file named "
(code "haunt.scm")
" and a "
(code "posts")
" directory populated with the articles to publish,
the site can be built by running "
(code "haunt build")
". Once the site is built, running "
(code "haunt serve")
" and visiting "
(code "localhost:8080")
" in a web browser will show the results of the build
without needing to upload the generated files to a web server.")
(h2 "News")
(ul
,@(map (lambda (post)
`(li
(a (@ (href ,(post-uri post)))
,(post-ref post 'title)
" — "
,(date->string* (post-date post)))))
(posts/reverse-chronological posts)))
(h2 "License")
(p "Haunt is "
(a (@ (href "https://www.gnu.org/philosophy/free-sw.html"))
"Free Software")
" available under the "
(a (@ (href "https://www.gnu.org/licenses/gpl.html"))
"GNU General Public License")
" version 3 or later.")
(h2 "Contributing")
(p "Patches to fix bugs or add new functionality are
highly encouraged. In lieu of a mailing list, please send patches
to "
(code "davet") " at " (code "gnu") " dot " (code "org")
" for now.")
(p "To get the latest version of the source code, clone
the official git repository:")
(pre "git clone git://dthompson.us/haunt.git")))))
(define (downloads-page site posts)
(define body
`((h2 "Downloads")
(table (@ (class "table"))
(thead
(tr (th "Source") (th "GPG signature")))
(tbody
,(map (match-lambda
((version signature?)
(let ((tarball-name (string-append "haunt-" version ".tar.gz")))
`(tr
(td (a (@ (href ,(tarball-url version))) ,tarball-name))
(td ,(if signature?
`(a (@ (href ,(tarball-signature-url version)))
,(string-append tarball-name ".sig"))
""))))))
%releases)))))
(make-page "downloads.html"
(with-layout haunt-theme site "Downloads" body)
sxml->html))
(define %collections
`(("Home" "index.html" ,posts/reverse-chronological)))
(site #:title "Haunt"
#:domain "dthompson.us"
#:default-metadata
'((author . "David Thompson")
(email . "davet@gnu.org"))
#:readers (list sxml-reader skribe-reader)
#:builders (list (blog #:theme haunt-theme #:collections %collections)
(atom-feed)
(atom-feeds-by-tag)
downloads-page
(static-directory "images")
(static-directory "css")
(static-directory "js")
(static-directory "manual")))
|