@@ 33,35 33,6 @@
"Convert DATE to human readable string."
(date->string date "~B ~d, ~Y"))
-(define simple-theme
- (theme #:name "Paper Like"
- #:layout
- (lambda (site title body)
- `((doctype "html")
- (head
- (meta (@ (charset "utf-8")))
- (title ,(string-append title " — " (site-title site)))
- ,(stylesheet "simple")
- ,(stylesheet "paper"))
- (body
- (div (@ (class "container"))
- ,body
- ,%default-footer))))
- #:post-template
- (lambda (post)
- `((h1 (@ (style "text-align:center")) ,(post-ref post 'title))
- (p (@ (style "text-align:center"))
- ,(post-ref post 'author)
- (br)
- (small
- "Department of Blog Posts, " (a (@ (href "/")) "trop.in"))
- (br)
- (small ,(date->string* (post-date post))))
- (div
- (h2 (@ (class "nonumber")) "Abstract")
- ,(post-ref post 'abstract)
- ,(post-sxml post))))))
-
(define* (page-theme
#:key
(footer %default-footer))
@@ 81,6 52,54 @@
(lambda (post)
`((div ,(post-sxml post))))))
+(define (paper-layout site title body)
+ `((doctype "html")
+ (head
+ (meta (@ (charset "utf-8")))
+ (title ,(string-append title " — " (site-title site)))
+ ,(stylesheet "simple")
+ ,(stylesheet "paper"))
+ (body
+ (div (@ (class "container"))
+ ,body
+ ,%default-footer))))
+
+(define (paper-collection-template site title posts prefix)
+ (define (post-uri post)
+ (string-append (or prefix "") "/"
+ (site-post-slug site post) ".html"))
+
+ `((h1 ,title)
+ (ul
+ ,@(map (lambda (post)
+ `(li
+ (a (@ (href ,(post-uri post)))
+ ,(post-ref post 'title)
+ " — "
+ ,(date->string* (post-date post)))))
+ posts))))
+
+(define (paper-post-template post)
+ `((h1 (@ (style "text-align:center")) ,(post-ref post 'title))
+ (p (@ (style "text-align:center"))
+ ,(post-ref post 'author)
+ (br)
+ (small
+ "Department of Blog Posts, " (a (@ (href "/")) "trop.in"))
+ (br)
+ (small ,(date->string* (post-date post))))
+ (div
+ (h2 "Abstract")
+ ,(post-ref post 'abstract)
+ (div (@ (class "post-content"))
+ ,(post-sxml post)))))
+
+(define paper-theme
+ (theme #:name "Paper Like"
+ #:layout paper-layout
+ #:collection-template paper-collection-template
+ #:post-template paper-post-template))
+
(use-modules (haunt artifact))
(define (verbatim-artifact source destination)
@@ 105,17 124,6 @@ build-directory of the site."
(read-post reader file '()))
sxml->html))))
-(define (wrap f)
- (lambda (site posts)
- ((@ (ice-9 pretty-print) pretty-print)
- site)
- ((@ (ice-9 pretty-print) pretty-print)
- posts)
- (let ((sd (f site posts)))
- ((@ (ice-9 pretty-print) pretty-print)
- sd)
- sd)))
-
(define (posts/filter-by-tag tag)
(lambda (posts)
@@ 125,9 133,9 @@ build-directory of the site."
(list)))))
(define %blog-collections
- `(("All" "index.html" ,posts/reverse-chronological)
- ("Tech" "tech.html" ,(posts/filter-by-tag "tech"))
- ("Personal" "personal.html" ,(posts/filter-by-tag "personal"))))
+ `(("trop.in/blog" "index.html" ,posts/reverse-chronological)
+ ("trop.in/tech" "tech.html" ,(posts/filter-by-tag "tech"))
+ ("trop.in/life" "life.html" ,(posts/filter-by-tag "life"))))
(define-public main-site
(site #:title "trop.in"
@@ 147,7 155,7 @@ build-directory of the site."
(static-page "pages/contact.md" "contact.html")
(static-page "pages/sport.md" "sport.html")
(static-page "pages/rde/index.md" "rde/index.html")
- (blog #:theme simple-theme
+ (blog #:theme paper-theme
#:prefix "/blog"
#:collections %blog-collections)
(static-directory "assets" "assets")