summaryrefslogtreecommitdiff
path: root/theme.scm
blob: 4485c62db0b6a4da3d1e618d8416f8bb1a5d5b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(define-module (theme)
  #:use-module (haunt artifact)
  #:use-module (haunt asset)
  #:use-module (haunt builder blog)
  #:use-module (haunt html)
  #:use-module (haunt post)
  #:use-module (haunt site)
  #:use-module (srfi srfi-19)
  #:export (vin-theme))

(define (link name uri)
  `(a (@ (href ,uri)) ,name))

(define vin-theme
  (theme #:name "vin"
	 #:layout
	 (lambda (site title body)
	   `((doctype "html")
	     (head
	      (meta (@ (charset "utf-8")))
	      (meta (@ (name "viewport")
		       (content "width=device-width, initial-scale=1")))
	      (title ,(string-append title " - " (site-title site)))
	      (link (@ (rel "alternate")
		       (type "application/atom+xml")
		       (title "Atom feed")
		       (href "/feed.xml")))
	      (link (@ (rel "icon")
		       (type "image/png")
		       (href "/static/AT_terminus.png")))
	      (link (@ (rel "stylesheet")
		       (type "text/css")
		       (href "/static/main.css")))
	      (body
	       (div (@ (class "container"))
		    (nav
		     (ul (li ,(link "Vineet K" "/")))
		     (ul (li ,(link "About Me" "/about.html"))
			 (li ,(link "Blog" "/index.html"))
			 ;; (li ,(link "Projects" "/projects.html"))
			 ))
		    ,body
		    (footer (@ (class "text-center"))
			    (p "The content for the site is under the " ,(link "CC-BY-NC-SA-4.0 License" "/static/cc-by-nc-sa-4.0.txt") ". "
			       "The code for this site is under the " ,(link "GNU AGPLv3 License" "/static/agpl-3.0.txt") ".")))))))
	 #:post-template
	 (lambda (post)
	   `((article
	      (h1 (@ (class "title"))
		  ,(post-ref post 'title))
	      (div (@ (class "date"))
		   ,(date->string (post-date post)
				  "~B ~d, ~Y"))
	      (div (@ (class "post"))
		   ,(post-sxml post)))))
	 #:collection-template
	 (lambda (site title posts prefix)
	   (define (post-uri post)
	     (string-append prefix "/" (site-post-slug site post) ".html"))
	   `((h2 ,title " "
		 (a (@ (href "/feed.xml")) "(feed)"))
	     ,(map (lambda (post)
		     (let ((uri (post-uri post)))
		       `(div (@ (class "posts"))
			     (div (@ (class "post"))
				  (span (span (@ (class "date"))
					      ,(date->string
						(post-date post)
						"~Y-~m-~d"))
					" - "
					(a (@ (href ,uri))
					   ,(post-ref post 'title)))))))
		   posts)))))