guix-hpc.scm 1.1 KB
Newer Older
Ludovic Courtès's avatar
Ludovic Courtès committed
1 2 3 4 5 6 7
;;; This module is part of Guix-HPC and is licensed under the same terms,
;;; those of the GNU GPL version 3 or (at your option) any later version.
;;;
;;; Copyright © 2017 Inria

(define-module (guix-hpc)
  #:use-module (haunt page)
8
  #:use-module (haunt site)
Ludovic Courtès's avatar
Ludovic Courtès committed
9 10 11
  #:use-module (sxml simple)
  #:use-module (haunt reader)
  #:use-module (haunt reader commonmark)
12 13 14 15
  #:export (base-url
            image-url
            css-url
            post-url
Ludovic Courtès's avatar
Ludovic Courtès committed
16

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
            static-pages))

(define (base-url . location)
  (string-concatenate (cons "" location)))

(define (image-url location)
  (base-url "static/images" location))

(define (css-url location)
  (base-url "static/css" location))

(define (post-url post site)
  "Return the URL of POST, a Haunt blog post, for SITE."
  (base-url (site-post-slug site post) ".html"))


Ludovic Courtès's avatar
Ludovic Courtès committed
33 34 35 36 37 38 39 40 41 42 43 44
(define %cwd
  (and=> (assq-ref (current-source-location) 'filename)
         dirname))

(define read-markdown
  (reader-proc commonmark-reader))

(define (about-page)
  (read-markdown (string-append %cwd "/about.md")))

(define (static-pages)
  (list (make-page "about.html" (about-page) sxml->xml)))