From 9afcb7cec8e4d12b0aaec81dcdb852570d5b67c4 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sat, 8 Jun 2019 13:30:17 -0400 Subject: [PATCH] [WIP] Begin blog index --- src/blog/index.html.pm | 22 ++++++++++++++++++++++ src/index.ptree | 7 ++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/blog/index.html.pm diff --git a/src/blog/index.html.pm b/src/blog/index.html.pm new file mode 100644 index 0000000..b413086 --- /dev/null +++ b/src/blog/index.html.pm @@ -0,0 +1,22 @@ +#lang pollen + +◊(require pollen/pagetree + pollen/file + racket/path) + +◊(define here-path (select-from-metas 'here-path metas)) +◊(define ptree (get-pagetree (build-path + (path-only (string->path here-path)) + 'up + "index.ptree"))) +◊(current-pagetree ptree) + +◊(define (get-posts) + (children 'blog)) + +◊for/splice[((post (get-posts)))]{ + ◊let[((src (get-source (path->string (path->complete-path (symbol->string post))))))]{ + ◊(string-append "blog/" (symbol->string post)) + ◊;◊link[#:href ◊post]{◊(select 'h1 src)} + } +} \ No newline at end of file diff --git a/src/index.ptree b/src/index.ptree index 7ecbc84..9381fd4 100644 --- a/src/index.ptree +++ b/src/index.ptree @@ -1,4 +1,9 @@ #lang pollen +◊(require racket/string) index.html -blog \ No newline at end of file +◊`(blog + ,@(map string->symbol + (remove "index.html" + (filter (lambda (p) (string-suffix? p ".html")) + (map path->string (directory-list "blog"))))))