error pages
This commit is contained in:
parent
7f3d75abca
commit
0e9bd79d00
|
@ -5,17 +5,15 @@
|
|||
- user pages
|
||||
- search form
|
||||
- page tags should link to the tag index
|
||||
- error pages: 404, 500, etc
|
||||
|
||||
# wishlist
|
||||
|
||||
- prefers-color-scheme
|
||||
- robots.txt, sitemap.xml
|
||||
- firefox alternative stylesheets too maybe (send more js for chrome to do the thing too)
|
||||
- explicitly block brave (also needs js)
|
||||
- make /unsupported-browser page for brave
|
||||
- rss/atom
|
||||
- indieweb: microformats2, webmentions, websub, rel=me
|
||||
- reject brave (lol)
|
||||
- support tor and opennic
|
||||
- activitypub
|
||||
- gopher and gemini variants
|
||||
|
|
17
init.rkt
17
init.rkt
|
@ -13,6 +13,7 @@
|
|||
(define src (simple-form-path (build-path dir "src")))
|
||||
(define target (simple-form-path (build-path dir "target")))
|
||||
(make-directory* src)
|
||||
(make-directory* target)
|
||||
(with-output-to-file
|
||||
(build-path src "index.md")
|
||||
(λ ()
|
||||
|
@ -37,6 +38,22 @@
|
|||
(build-path src "config.rktd")
|
||||
(λ () (pretty-write (list (list 'base "http://localhost:8080")))))
|
||||
|
||||
(with-output-to-file
|
||||
(build-path src "40x.md")
|
||||
(λ ()
|
||||
(pretty-write
|
||||
'((title "error page")
|
||||
(lang "en")))
|
||||
(write-string "\n# error\n\nno such page; or you are not authorized to view it")))
|
||||
|
||||
(with-output-to-file
|
||||
(build-path src "50x.md")
|
||||
(λ ()
|
||||
(pretty-write
|
||||
'((title "error page")
|
||||
(lang "en")))
|
||||
(write-string "\n# error\n\nthe server ran into an error :(")))
|
||||
|
||||
(with-output-to-file
|
||||
(build-path dir "nginx.conf")
|
||||
(λ ()
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
|
||||
(define *reserved-slugs*
|
||||
(apply set (map build-path '("hashtag" "user" "tech" "capybara" "dynamic" "robots.txt"
|
||||
"sitemap.xml" "feeds"))))
|
||||
"sitemap.xml" "feeds" "unsupported-browser"))))
|
||||
|
||||
(define *special-slugs*
|
||||
(apply set (map build-path '("/40x" "/50x"))))
|
||||
|
||||
(define (read-input-doc xref-name [port (current-input-port)])
|
||||
(define metadata (read port))
|
||||
|
@ -293,7 +296,8 @@
|
|||
;; TODO : this sucks
|
||||
;; we should have a radix tree
|
||||
(define xrefs-repo
|
||||
(for/set ([spec (in-list rule-specs)])
|
||||
(for/set ([spec (in-list rule-specs)]
|
||||
#:unless (set-member? *special-slugs* (rule-spec-xref-name spec)))
|
||||
(define exploded (explode-path (rule-spec-xref-name spec)))
|
||||
(when (and (> (length exploded) 1)
|
||||
(set-member? *reserved-slugs* (second exploded)))
|
||||
|
|
|
@ -30,6 +30,8 @@ http {
|
|||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
sub_filter "__X_MATHJAX_POLYFILL_PLACEHOLDER__" $mathjax_polyfill;
|
||||
error_page 401 403 404 410 /40x.html;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue