~technomancy/fennel-lang.org

fc2461d9cbb7e4018622b74c04004ec1a23a18f2 — Phil Hagelberg 1 year, 8 months ago 67381f1
Show proper 404 on the wiki.
2 files changed, 18 insertions(+), 10 deletions(-)

M wiki/404.html
M wiki/index.fnl
M wiki/404.html => wiki/404.html +2 -0
@@ 11,5 11,7 @@
    <p>Whatever you're looking for, it's not here. Unless you're
      looking for the 404 error page. If that's what you want,
      congratulations. You found it.</p>

    <p>Maybe try going <a href="/">back to home</a> for now.</p>
  </body>
</html>

M wiki/index.fnl => wiki/index.fnl +16 -10
@@ 7,7 7,6 @@
       "<!DOCTYPE html>
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">
<head>
  <meta charset=\"utf-8\" />
  <link rel=\"stylesheet\" href=\"https://fennel-lang.org/fennel.css\"></link>
  <link rel=\"stylesheet\" href=\"https://code.cdn.mozilla.net/fonts/fira.css\"/>
  <title>Fennel wiki: %s</title>


@@ 39,12 38,19 @@

(let [page (match (query-string) "" "Home" p p)
      body (get-body (query-string))
      out [(head:format page)
           (string.format "<h1>Fennel wiki: %s</h1>" page)
           ;; this leaves a ton of unmatched closing divs but who cares
           (body:match "<div id=\"wiki%-body\".*</turbo%-frame>")
           foot]]
  (print "content-encoding: utf8")
  (print "content-type: text/html")
  (print "")
  (print (table.concat out "\n")))
      out (if (not= 0 (length body))
              [(head:format page)
               (string.format "<h1>Fennel wiki: %s</h1>" page)
               ;; this leaves a ton of unmatched closing divs but who cares
               (body:match "<div id=\"wiki%-body\".*</turbo%-frame>")
               foot])]
  (if out
      (do
        (print "content-encoding: utf8")
        (print "content-type: text/html")
        (print "")
        (print (table.concat out "\n")))
      (do
        (print "status: 404 not found")
        (print "")
        (print (with-open [f (io.open "404.html")] (f:read :*all))))))