website: Add support for Haunt.

This provides a simple way to build the website locally.

* website/haunt.scm: New file.
* website/README: Document the new build process.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Mathieu Lirzin 2015-11-03 22:02:07 +01:00 committed by Ludovic Courtès
parent d25d352aa3
commit 580af4b382
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 67 additions and 4 deletions

View File

@ -15,10 +15,13 @@ website]] which is implemented in [[https://www.gnu.org/software/guile][Guile]]
* Building
In this implementation, links assume =/software/guix= is the root directory of
the website. In order to build the website on your machine, you will want to
modify the values of (current-url-root) and (gnu.org-root) parameter
objects.
Building the website depends on the static site generator:
- [[http://haunt.dthompson.us/][Haunt]]
To build the site, run haunt build to compile all of the HTML pages.
To view the results, run haunt serve and visit <http://localhost:8080>
in a web browser.
* Copying

60
website/haunt.scm Normal file
View File

@ -0,0 +1,60 @@
;;; GuixSD website --- GNU's advanced distro website
;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GuixSD website.
;;;
;;; GuixSD website 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.
;;;
;;; GuixSD website 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 GuixSD website. If not, see <http://www.gnu.org/licenses/>.
;; This is a build file for Haunt.
(use-modules (haunt site)
(haunt reader)
(haunt page)
(haunt html)
(haunt utils)
(haunt builder assets)
(ice-9 match)
(www)
(www utils))
(define %local-test?
;; True when we're testing locally, as opposed to producing things to
;; install to gnu.org.
(or (getenv "GUIX_WEB_SITE_LOCAL")
(member "serve" (command-line)))) ;'haunt serve' command
(when %local-test?
;; The URLs produced in these pages are only meant for local consumption.
(format #t "~%Producing Web pages for local tests *only*!~%~%"))
(site #:title "GNU's advanced distro and transactional package manager"
#:domain "//www.gnu.org/software/guix"
#:default-metadata
'((author . "GuixSD Contributors")
(email . "guix-devel@gnu.org"))
#:readers (list sxml-reader)
#:builders
`(,@(map (match-lambda
((file-name contents)
(lambda (site posts)
(parameterize ((current-url-root (if %local-test?
""
(current-url-root)))
(gnu.org-root (if %local-test?
"https://www.gnu.org"
(gnu.org-root))))
(make-page file-name (contents) sxml->html)))))
%web-pages)
,(static-directory "static")))