summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2015-11-03 22:02:07 +0100
committerLudovic Courtès <ludo@gnu.org>2016-10-26 23:16:52 +0200
commit580af4b3823357b04be87319975d9e3dab11b85a (patch)
treeba8c3807af46f1a186dd1681079e1a44915bbebf
parentd25d352aa3b498e854a65989502973f5c27d039a (diff)
downloadguix-artwork-580af4b3823357b04be87319975d9e3dab11b85a.tar
guix-artwork-580af4b3823357b04be87319975d9e3dab11b85a.tar.gz
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>
-rw-r--r--website/README11
-rw-r--r--website/haunt.scm60
2 files changed, 67 insertions, 4 deletions
diff --git a/website/README b/website/README
index 9112726..5438a5d 100644
--- a/website/README
+++ b/website/README
@@ -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
diff --git a/website/haunt.scm b/website/haunt.scm
new file mode 100644
index 0000000..ec37fcf
--- /dev/null
+++ b/website/haunt.scm
@@ -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")))