diff options
Diffstat (limited to 'theme.scm')
| -rw-r--r-- | theme.scm | 33 |
1 files changed, 29 insertions, 4 deletions
@@ -1,10 +1,12 @@ (define-module (theme) #:use-module (haunt html) #:use-module (haunt site) + #:use-module (haunt post) #:use-module (haunt builder blog) #:export (hwebs-theme flat-page-template)) + (define hwebs-theme (theme #:name "hwebs" #:layout @@ -12,17 +14,40 @@ `((doctype "html") (html (head - (meta (@ (charset "utf-8"))) + (meta (@ (http-equiv "Content-Type") + (content "text/html") + (charset "utf-8"))) (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) (link (@ (rel "stylesheet") - (href "style.css"))) + (type "text/css") + (href "/style.css"))) (title ,(string-append title " — " (site-title site)))) (body - (header (span ,(assq-ref (site-default-metadata site) 'author))) + (header (span ,(assq-ref (site-default-metadata site) 'author)) + (nav (ul (li (a (@ (href "/")) "Home")) + (li (a (@ (href "/blog")) "Blog"))))) (main (article (h1 ,title) - ,body)))))))) + ,body)))))) + #:post-template + (lambda (post) + ;; TODO fill in datetime correctly + ;; TODO add <author>? (as hidden?) + `((time ,(date->string*(post-date post))) + ,(post-sxml post))) + #:collection-template + (lambda (site title posts prefix) + (define (post-uri post) + (string-append "/" (or prefix "") "/" + (site-post-slug site post) ".html")) + `((ul + ,@(map (lambda (post) + `(li (a (@ (href ,(post-uri post))) + ,(post-ref post 'title) + " — " + ,(date->string* (post-date post))))) + posts)))))) (define (flat-page-template site metadata body) ((theme-layout hwebs-theme) site (assq-ref metadata 'title) body)) |
