add index file for /{resource} paths
This commit is contained in:
parent
f9baec0fd8
commit
6f2040edff
4 changed files with 7 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
**/**.**~
|
**/**.**~
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
|
sorrel/**
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
(prefix-in files: web-server/dispatchers/dispatch-files)
|
(prefix-in files: web-server/dispatchers/dispatch-files)
|
||||||
(prefix-in filter: web-server/dispatchers/dispatch-filter)
|
(prefix-in filter: web-server/dispatchers/dispatch-filter)
|
||||||
(prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)
|
(prefix-in sequencer: web-server/dispatchers/dispatch-sequencer)
|
||||||
|
racket/runtime-path
|
||||||
web-server/dispatchers/filesystem-map
|
web-server/dispatchers/filesystem-map
|
||||||
web-server/http
|
web-server/http
|
||||||
csv-reading)
|
csv-reading)
|
||||||
|
@ -19,7 +20,6 @@
|
||||||
(define-namespace-anchor anc)
|
(define-namespace-anchor anc)
|
||||||
(define ns (namespace-anchor->namespace anc))
|
(define ns (namespace-anchor->namespace anc))
|
||||||
|
|
||||||
|
|
||||||
(define (html-response content)
|
(define (html-response content)
|
||||||
(response/full
|
(response/full
|
||||||
200
|
200
|
||||||
|
@ -42,7 +42,6 @@
|
||||||
(build-path "source" type "index")
|
(build-path "source" type "index")
|
||||||
(build-path "source" "index" ))
|
(build-path "source" "index" ))
|
||||||
#".txt")])
|
#".txt")])
|
||||||
(displayln res-path)
|
|
||||||
(if (file-exists? res-path)
|
(if (file-exists? res-path)
|
||||||
(html-response (resource-processor res-path))
|
(html-response (resource-processor res-path))
|
||||||
(html-response (resource-processor "source/not-found.txt"))))]
|
(html-response (resource-processor "source/not-found.txt"))))]
|
||||||
|
@ -74,14 +73,11 @@
|
||||||
(xexpr->string (read (open-input-file file)))))
|
(xexpr->string (read (open-input-file file)))))
|
||||||
|
|
||||||
(define (build-index res)
|
(define (build-index res)
|
||||||
;; get all the entries in res table
|
|
||||||
;; build index
|
|
||||||
(let* ([table (csv->list (open-input-file
|
(let* ([table (csv->list (open-input-file
|
||||||
(path-add-extension
|
(path-add-extension
|
||||||
(build-path "data" res)
|
(build-path "data" res) #".csv")))]
|
||||||
#".csv")))]
|
|
||||||
[make-index
|
[make-index
|
||||||
(read (open-input-file "data/make-index.txt"))]
|
(read (open-input-file "source/make-index.txt"))]
|
||||||
[index ((eval make-index ns) res (rest table))])
|
[index ((eval make-index ns) res (rest table))])
|
||||||
(lambda (req)
|
(lambda (req)
|
||||||
(if (equal? res "tagged")
|
(if (equal? res "tagged")
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
(p (em (~a "everything (or maybe just some things) i've ever said about \"~a\"" tag)))))]
|
(p (em (~a "everything (or maybe just some things) i've ever said about \"~a\"" tag)))))]
|
||||||
[else
|
[else
|
||||||
'(hgroup (h1 "i'm lost")
|
'(hgroup (h1 "i'm lost")
|
||||||
(p (em "you weren't meant to be here")))]))])
|
(p (em "you weren't meant to be here")))])
|
||||||
|
(h3 "the thoughts"))])
|
||||||
(define (settled-post post)
|
(define (settled-post post)
|
||||||
`((div ((class "post-preview"))
|
`((div ((class "post-preview"))
|
||||||
(h4 ,(second post))
|
(h4 ,(second post))
|
||||||
|
|
|
@ -66,7 +66,7 @@ body {
|
||||||
max-width: 600;
|
max-width: 600;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
font-family: Verdana, ui-sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
header{
|
header{
|
||||||
|
|
Loading…
Reference in a new issue