Commit d7dd7c12 authored by Neil Mather's avatar Neil Mather

Add a page with information about how the website is built

Add a link to it in the footer.
parent ffeb1c8e
Pipeline #73314704 passed with stage
in 51 seconds
......@@ -34,6 +34,66 @@
(sxml transform)
(web uri))
(define %collections
`(("Recent Blog Posts" "index.html" ,posts/reverse-chronological)))
(define parse-lang
(let ((rx (make-regexp "-*-[ ]+([a-z]*)[ ]+-*-")))
(lambda (port)
(let ((line (read-line port)))
(match:substring (regexp-exec rx line) 1)))))
(define (maybe-highlight-code lang source)
(let ((lexer (match lang
('scheme lex-scheme)
('xml lex-xml)
('c lex-c)
(_ #f))))
(if lexer
(highlights->sxml (highlight lexer source))
source)))
(define (sxml-identity . args) args)
(define (highlight-code . tree)
(sxml-match tree
((code (@ (class ,class) . ,attrs) ,source)
(let ((lang (string->symbol
(string-drop class (string-length "language-")))))
`(code (@ ,@attrs)
,(maybe-highlight-code lang source))))
(,other other)))
(define (highlight-scheme code)
`(pre (code ,(highlights->sxml (highlight lex-scheme code)))))
;; Markdown doesn't support video, so let's hack around that! Find
;; <img> tags with a ".webm" source and substitute a <video> tag.
(define (media-hackery . tree)
(sxml-match tree
((img (@ (src ,src) . ,attrs) . ,body)
(if (string-suffix? ".webm" src)
`(video (@ (src ,src) (controls "true"),@attrs) ,@body)
tree))))
(define %commonmark-rules
`((code . ,highlight-code)
(img . ,media-hackery)
(*text* . ,(lambda (tag str) str))
(*default* . ,sxml-identity)))
(define (post-process-commonmark sxml)
(pre-post-order sxml %commonmark-rules))
(define commonmark-reader*
(make-reader (make-file-extension-matcher "md")
(lambda (file)
(call-with-input-file file
(lambda (port)
(values (read-metadata-headers port)
(post-process-commonmark
(commonmark->sxml port))))))))
(define evalapply-theme
(theme #:name "evalapply"
#:layout
......@@ -73,7 +133,14 @@
,%cc-by-sa-button)
(p "The text and images on this site are
free culture works available under the " ,%cc-by-sa-link " license.")
(p "This website is built with "
(p "This website "
" ("
(a (@ (href "https://gitlab.com/evalapply/evalapply.gitlab.io"))
"source")
" and "
(a (@ (href "/website.html"))
"more info")
") is built with "
(a (@ (href "http://haunt.dthompson.us"))
"Haunt")
", a static site generator written in "
......@@ -110,66 +177,6 @@ free culture works available under the " ,%cc-by-sa-link " license.")
(a (@ (href ,uri)) "read more ➔"))))
posts)))))
(define %collections
`(("Recent Blog Posts" "index.html" ,posts/reverse-chronological)))
(define parse-lang
(let ((rx (make-regexp "-*-[ ]+([a-z]*)[ ]+-*-")))
(lambda (port)
(let ((line (read-line port)))
(match:substring (regexp-exec rx line) 1)))))
(define (maybe-highlight-code lang source)
(let ((lexer (match lang
('scheme lex-scheme)
('xml lex-xml)
('c lex-c)
(_ #f))))
(if lexer
(highlights->sxml (highlight lexer source))
source)))
(define (sxml-identity . args) args)
(define (highlight-code . tree)
(sxml-match tree
((code (@ (class ,class) . ,attrs) ,source)
(let ((lang (string->symbol
(string-drop class (string-length "language-")))))
`(code (@ ,@attrs)
,(maybe-highlight-code lang source))))
(,other other)))
(define (highlight-scheme code)
`(pre (code ,(highlights->sxml (highlight lex-scheme code)))))
;; Markdown doesn't support video, so let's hack around that! Find
;; <img> tags with a ".webm" source and substitute a <video> tag.
(define (media-hackery . tree)
(sxml-match tree
((img (@ (src ,src) . ,attrs) . ,body)
(if (string-suffix? ".webm" src)
`(video (@ (src ,src) (controls "true"),@attrs) ,@body)
tree))))
(define %commonmark-rules
`((code . ,highlight-code)
(img . ,media-hackery)
(*text* . ,(lambda (tag str) str))
(*default* . ,sxml-identity)))
(define (post-process-commonmark sxml)
(pre-post-order sxml %commonmark-rules))
(define commonmark-reader*
(make-reader (make-file-extension-matcher "md")
(lambda (file)
(call-with-input-file file
(lambda (port)
(values (read-metadata-headers port)
(post-process-commonmark
(commonmark->sxml port))))))))
(define (static-page title file-name body)
(lambda (site posts)
(make-page file-name
......@@ -281,6 +288,23 @@ free culture works available under the " ,%cc-by-sa-link " license.")
(p "We can be reached at " ,(link "lambda@evalapply.space" "mailto:lambda@evalapply.space"))
)))
(define website-page
(static-page
"Website details"
"website.html"
`((h2 "Website")
(p "This website is made with " ,(link "Haunt" "https://dthompson.us/projects/haunt.html")
", a static site generator written in Guile Scheme.")
(p "The source of this site is available " ,(link "here" "https://gitlab.com/evalapply/evalapply.gitlab.io") ".")
(p "The site is heavily based on " ,(link "dthompson's website" "https://dthompson.us/")
", the source for which is " ,(link "available here" "https://git.dthompson.us/blog.git") ".")
(p ,(link "jakob.space" "https://jakob.space/")
" (" ,(link "source" "https://git.sr.ht/~jakob/blog") ") "
" is also very helpful for figuring out how to code a Haunt site.")
(p "We use Gitlab Pages to host our site - the statically generated pages are deployed to Pages on commit. "
"You can see the simple config for that " ,(link "here" "https://gitlab.com/evalapply/evalapply.gitlab.io/blob/master/.gitlab-ci.yml") ".")
)))
(site #:title "evalapply"
#:domain "evalapply.space"
#:default-metadata
......@@ -293,6 +317,7 @@ free culture works available under the " ,%cc-by-sa-link " license.")
resources-page
come-along-page
contact-page
website-page
;(blog #:theme evalapply-theme #:collections %collections)
(atom-feed)
(atom-feeds-by-tag)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment