site_vineetk

Source for vineetk.net website
Log | Files | Refs | LICENSE

theme.scm (2276B)


      1 (define-module (theme)
      2   #:use-module (haunt artifact)
      3   #:use-module (haunt asset)
      4   #:use-module (haunt builder blog)
      5   #:use-module (haunt html)
      6   #:use-module (haunt post)
      7   #:use-module (haunt site)
      8   #:use-module (srfi srfi-19)
      9   #:export (vin-theme))
     10 
     11 (define (link name uri)
     12   `(a (@ (href ,uri)) ,name))
     13 
     14 (define vin-theme
     15   (theme #:name "vin"
     16 	 #:layout
     17 	 (lambda (site title body)
     18 	   `((doctype "html")
     19 	     (head
     20 	      (meta (@ (charset "utf-8")))
     21 	      (meta (@ (name "viewport")
     22 		       (content "width=device-width, initial-scale=1")))
     23 	      (title ,(string-append title " - " (site-title site)))
     24 	      (link (@ (rel "alternate")
     25 		       (type "application/atom+xml")
     26 		       (title "Atom feed")
     27 		       (href "/feed.xml")))
     28 	      (link (@ (rel "icon")
     29 		       (type "image/png")
     30 		       (href "/static/AT_terminus.png")))
     31 	      (link (@ (rel "stylesheet")
     32 		       (type "text/css")
     33 		       (href "/static/main.css")))
     34 	      (body
     35 	       (div (@ (class "container"))
     36 		    (nav
     37 		     (ul (li ,(link "Vineet K" "/")))
     38 		     (ul (li ,(link "About Me" "/about.html"))
     39 			 (li ,(link "Blog" "/index.html"))
     40 			 ;; (li ,(link "Projects" "/projects.html"))
     41 			 ))
     42 		    ,body
     43 		    (footer (@ (class "text-center"))
     44 			    (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") ". "
     45 			       "The code for this site is under the " ,(link "GNU AGPLv3 License" "/static/agpl-3.0.txt") ".")))))))
     46 	 #:post-template
     47 	 (lambda (post)
     48 	   `((article
     49 	      (h1 (@ (class "title"))
     50 		  ,(post-ref post 'title))
     51 	      (div (@ (class "date"))
     52 		   ,(date->string (post-date post)
     53 				  "~B ~d, ~Y"))
     54 	      (div (@ (class "post"))
     55 		   ,(post-sxml post)))))
     56 	 #:collection-template
     57 	 (lambda (site title posts prefix)
     58 	   (define (post-uri post)
     59 	     (string-append prefix "/" (site-post-slug site post) ".html"))
     60 	   `((h2 ,title " "
     61 		 (a (@ (href "/feed.xml")) "(feed)"))
     62 	     ,(map (lambda (post)
     63 		     (let ((uri (post-uri post)))
     64 		       `(div (@ (class "posts"))
     65 			     (div (@ (class "post"))
     66 				  (span (span (@ (class "date"))
     67 					      ,(date->string
     68 						(post-date post)
     69 						"~Y-~m-~d"))
     70 					" - "
     71 					(a (@ (href ,uri))
     72 					   ,(post-ref post 'title)))))))
     73 		   posts)))))