Commit b48bb94a authored by wanderer's avatar wanderer 💬

added template.scm

parent 02f0f7c7
Pipeline #128469977 passed with stages
in 52 seconds
(define-module (template)
#:use-module (haunt builder blog)
#:use-module (haunt site)
#:use-module (haunt post)
#:export (wanderer-theme))
(define (stylesheet name)
`(link (@ (rel "stylesheet")
(href ,(string-append "/css/" name ".css")))))
(define (wanderer-layout site title body)
`((doctype "html")
(head
(meta (@ (charset "utf-8")))
(meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0")))
(title ,(string-append title " — " (site-title site)))
,(stylesheet "wanderer"))
(body
(header (@ (class "no-margin"))
(h1 (@ (class "no-margin")
(id "site-title"))
,(site-title site)))
,body
(footer ,pattern))))
(define (wanderer-post-template post)
`((main (article
(header (@ (class "no-margin"))
(h2 (@ (class "no-margin")
(id "post-title"))
,(post-ref post 'title))
(h3 (@ (class "no-margin")
(id "post-author"))
"by " ,(post-ref post 'author)
" — " ,(date->string* (post-date post))))
(div ,(post-sxml post))))))
(define (wanderer-collection-template site title posts prefix)
(define (post-uri post)
(string-append (or prefix "") "/"
(site-post-slug site post) ".html"))
`((h3 ,title)
(ul
,@(map (lambda (post)
`(li
(a (@ (href ,(post-uri post)))
,(post-ref post 'title)
" — "
,(date->string* (post-date post)))))
posts))))
(define wanderer-theme
(theme #:name "Wanderer"
#:layout wanderer-layout
#:post-template wanderer-post-template
#:collection-template wanderer-collection-template))
(define pattern '(svg (@ (style "display:block;width:100%;"))
(defs
(pattern (@ (id "emsqpat__255")
(viewBox "0,0,16,16")
(x "-8")
(y "0")
(width "32")
(height "32")
(patternUnits "userSpaceOnUse"))
(path (@ (style "fill:black;")
(d "M2 0v1c0 .563-.437 1-1 1H0v1h1c.065 0 .128-.013.191-.02A2.96 2.96 0 0 0 1 4c0 .345.071.673.18.982C1.119 4.985 1.062 5 1 5H0v1h1c.25 0 .494-.023.734-.059.1.117.208.225.325.325C2.023 6.506 2 6.75 2 7v2c0 .25.023.494.059.734a3.02 3.02 0 0 0-.325.325A5.019 5.019 0 0 0 1 10H0v1h1c.062 0 .119.015.18.018-.109.309-.18.637-.18.982 0 .36.075.7.191 1.02C1.128 13.013 1.065 13 1 13H0v1h1c.563 0 1 .437 1 1v1h1v-1c0-.065-.013-.128-.02-.191.32.116.66.191 1.02.191.345 0 .673-.071.982-.18.003.061.018.118.018.18v1h1v-1c0-.25-.023-.494-.059-.734.117-.1.225-.208.325-.325.24.036.484.059.734.059h2c.25 0 .494-.023.734-.059.1.117.208.225.325.325-.036.24-.059.484-.059.734v1h1v-1c0-.062.015-.119.018-.18.309.109.637.18.982.18.36 0 .7-.075 1.02-.191-.007.063-.02.126-.02.191v1h1v-1c0-.563.437-1 1-1h1v-1h-1c-.065 0-.128.013-.191.02.116-.32.191-.66.191-1.02 0-.345-.071-.673-.18-.982.061-.003.118-.018.18-.018h1v-1h-1c-.25 0-.494.023-.734.059a3.02 3.02 0 0 0-.325-.325C13.977 9.494 14 9.25 14 9V7c0-.25-.023-.494-.059-.734.117-.1.225-.208.325-.325.24.036.484.059.734.059h1V5h-1c-.062 0-.119-.015-.18-.018.109-.309.18-.637.18-.982 0-.36-.075-.7-.191-1.02.063.007.126.02.191.02h1V2h-1c-.563 0-1-.437-1-1V0h-1v1c0 .065.013.128.02.191A2.96 2.96 0 0 0 12 1c-.345 0-.673.071-.982.18C11.015 1.119 11 1.062 11 1V0h-1v1c0 .25.023.494.059.734a3.02 3.02 0 0 0-.325.325A5.019 5.019 0 0 0 9 2H7c-.25 0-.494.023-.734.059a3.02 3.02 0 0 0-.325-.325C5.977 1.494 6 1.25 6 1V0H5v1c0 .062-.015.119-.018.18A2.957 2.957 0 0 0 4 1c-.36 0-.7.075-1.02.191C2.987 1.128 3 1.065 3 1V0zm2 2c.289 0 .561.063.809.172-.045.145-.083.294-.143.432a4.992 4.992 0 0 0-2.062 2.062c-.138.06-.287.098-.432.143A2.003 2.003 0 0 1 2 4c0-1.11.89-2 2-2zm8 0c1.11 0 2 .89 2 2 0 .289-.063.561-.172.809-.145-.045-.294-.083-.432-.143a4.992 4.992 0 0 0-2.062-2.062c-.06-.138-.098-.287-.143-.432.248-.109.52-.172.809-.172zM7 3h2c.062 0 .119.015.18.018C9.07 3.327 9 3.655 9 4c0 .563-.437 1-1 1s-1-.437-1-1c0-.345-.071-.673-.18-.982C6.881 3.015 6.938 3 7 3zm-1.172.191C5.937 3.44 6 3.711 6 4c0 .536.217 1.023.564 1.383a3.012 3.012 0 0 0-1.181 1.181A1.99 1.99 0 0 0 4 6c-.289 0-.561-.063-.809-.172.045-.145.083-.294.143-.432a4.992 4.992 0 0 0 2.062-2.062c.138-.06.287-.098.432-.143zm4.344 0c.145.045.294.083.432.143a4.992 4.992 0 0 0 2.062 2.062c.06.138.098.287.143.432-.248.109-.52.172-.809.172a1.99 1.99 0 0 0-1.383.564 3.012 3.012 0 0 0-1.181-1.181A1.99 1.99 0 0 0 10 4c0-.289.063-.561.172-.809zM8 6c1.11 0 2 .89 2 2 0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2zm-4.982.82c.309.109.637.18.982.18.563 0 1 .437 1 1s-.437 1-1 1c-.345 0-.673.071-.982.18C3.015 9.119 3 9.062 3 9V7c0-.062.015-.119.018-.18zm9.964 0c.003.061.018.118.018.18v2c0 .062-.015.119-.018.18A2.957 2.957 0 0 0 12 9c-.563 0-1-.437-1-1s.437-1 1-1c.345 0 .673-.071.982-.18zm-7.6 2.616c.276.498.684.906 1.182 1.181A1.99 1.99 0 0 0 6 12c0 .289-.063.561-.172.809-.145-.045-.294-.083-.432-.143a4.992 4.992 0 0 0-2.062-2.062c-.06-.138-.098-.287-.143-.432.248-.109.52-.172.809-.172a1.99 1.99 0 0 0 1.383-.564zm5.235 0c.36.347.847.564 1.383.564.289 0 .561.063.809.172-.045.145-.083.294-.143.432a4.992 4.992 0 0 0-2.062 2.062c-.138.06-.287.098-.432.143A2.003 2.003 0 0 1 10 12a1.99 1.99 0 0 0-.564-1.383 3.012 3.012 0 0 0 1.181-1.181zM8 11c.563 0 1 .437 1 1 0 .345.071.673.18.982-.061.003-.118.018-.18.018H7c-.062 0-.119-.015-.18-.018.109-.309.18-.637.18-.982 0-.563.437-1 1-1zm-5.828.191c.145.045.294.083.432.143a4.992 4.992 0 0 0 2.062 2.062c.06.138.098.287.143.432-.248.109-.52.172-.809.172-1.11 0-2-.89-2-2 0-.289.063-.561.172-.809zm11.656 0c.109.248.172.52.172.809 0 1.11-.89 2-2 2-.289 0-.561-.063-.809-.172.045-.145.083-.294.143-.432a4.992 4.992 0 0 0 2.062-2.062c.138-.06.287-.098.432-.143z")))))
(rect (@ (x "0")
(y "0")
(width "100%")
(height "100%")
(fill "url(#emsqpat__255)"))></rect>)))
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