Redo blog index page

This commit is contained in:
Jeremy Dormitzer 2019-06-12 10:34:41 -04:00
parent 8b338f882b
commit 4696a3a839
3 changed files with 29 additions and 14 deletions

View File

@ -1,8 +1,10 @@
#lang pollen #lang pollen
(require pollen/pagetree (require pollen/core
pollen/pagetree
pollen/file pollen/file
racket/path) racket/path
racket/list)
(define here-path (select-from-metas 'here-path metas)) (define here-path (select-from-metas 'here-path metas))
(define ptree (get-pagetree (build-path (define ptree (get-pagetree (build-path
@ -14,13 +16,12 @@
(define (get-posts) (define (get-posts)
(children 'blog)) (children 'blog))
for/splice[((post (get-posts)))]{ (define (render-post post)
let[((src (get-source (path->string (path->complete-path (symbol->string post))))))]{ (let ((src (get-source (path->string (path->complete-path (symbol->string post))))))
div{ (div (title (select 'h1 src))
title{(select 'h1 src)} (published-date (select-from-metas 'published src))
published-date[(select-from-metas 'published src)] (excerpt post)
excerpt[post] (link "Read more..." #:href (symbol->string post)))))
link[#:href (symbol->string post)]{Read more...}
} (let ((rendered-posts (add-between (map render-post (get-posts)) (divider))))
} `(div ,@rendered-posts))
}

View File

@ -5,5 +5,6 @@ index.html
◊`(blog ◊`(blog
,@(map string->symbol ,@(map string->symbol
(remove "index.html" (remove "index.html"
(filter (lambda (p) (string-suffix? p ".html")) (map (lambda (s) (substring s 0 (- (string-length s) 3)))
(map path->string (directory-list "blog")))))) (filter (lambda (p) (string-suffix? p ".html.pm"))
(map path->string (directory-list "blog")))))))

View File

@ -9,6 +9,7 @@
(define link-hover-color "midnightblue") (define link-hover-color "midnightblue")
(define link-visited-color "purple") (define link-visited-color "purple")
(define nav-hover-color "#707070") (define nav-hover-color "#707070")
(define divider-color "#EFEFEF")
body { body {
height: 100%; height: 100%;
@ -42,6 +43,18 @@ a {
text-decoration: none; text-decoration: none;
} }
img {
width: 100%;
}
hr {
background-color: |divider-color|;
border-color: |divider-color|;
color: |divider-color|;
margin-top: 2.5em;
margin-bottom: 2.5em;
}
a:visited { a:visited {
color: |link-visited-color|; color: |link-visited-color|;
} }