diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-10-26 01:16:53 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-10-26 23:16:59 +0200 |
commit | 55c4d5b809d90dfce49192700db37e6b25fb5266 (patch) | |
tree | 09eb2b4d97a088df7ed8fa2ac889aeb1d2a8f3f2 /website/haunt.scm | |
parent | bccda311c2f1f61dedeece4fc402dee99d98668e (diff) | |
download | guix-artwork-55c4d5b809d90dfce49192700db37e6b25fb5266.tar guix-artwork-55c4d5b809d90dfce49192700db37e6b25fb5266.tar.gz |
website: Add "News" page.
* website/www/news.scm: New file.
* website/static/base/css/news.css: New file.
* website/haunt.scm (with-url-parameters): New macro.
(parameterized-procedure, parameterized-theme): New procedures.
<top level>: Use 'with-url-parameters' and add blog and atom feed.
Diffstat (limited to 'website/haunt.scm')
-rw-r--r-- | website/haunt.scm | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/website/haunt.scm b/website/haunt.scm index ec37fcf..7e694d2 100644 --- a/website/haunt.scm +++ b/website/haunt.scm @@ -25,9 +25,12 @@ (haunt html) (haunt utils) (haunt builder assets) + (haunt builder blog) + (haunt builder atom) (ice-9 match) (www) - (www utils)) + (www utils) + (www news)) (define %local-test? ;; True when we're testing locally, as opposed to producing things to @@ -39,6 +42,28 @@ ;; The URLs produced in these pages are only meant for local consumption. (format #t "~%Producing Web pages for local tests *only*!~%~%")) +(define-syntax-rule (with-url-parameters body ...) + "Run BODY in a context where URL parameters honor %LOCAL-TEST?." + (parameterize ((current-url-root (if %local-test? + "" + (current-url-root))) + (gnu.org-root (if %local-test? + "https://www.gnu.org" + (gnu.org-root)))) + body ...)) + +(define (parameterized-procedure proc) + (lambda args + (with-url-parameters + (apply proc args)))) + +(define (parameterized-theme thm) + (theme #:name (theme-name thm) + #:layout (parameterized-procedure (theme-layout thm)) + #:post-template (parameterized-procedure (theme-post-template thm)) + #:collection-template (parameterized-procedure + (theme-collection-template thm)))) + (site #:title "GNU's advanced distro and transactional package manager" #:domain "//www.gnu.org/software/guix" #:default-metadata @@ -49,12 +74,11 @@ `(,@(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)))) + (with-url-parameters (make-page file-name (contents) sxml->html))))) %web-pages) + ,(blog #:theme (parameterized-theme %news-haunt-theme) + #:prefix "news") + ,(atom-feed #:file-name "news/feed.xml" + #:blog-prefix "news") ,(static-directory "static"))) |