grug.scm (4341B)
1 (use-modules (grug site) 2 (grug builders) 3 (grug publishers) 4 (srfi srfi-19)) 5 6 (define (stylesheet name) 7 `(link (@ (rel "stylesheet") 8 (href ,(string-append "/css/" name ".css"))))) 9 10 (define (link name uri) 11 `(a (@ (href ,uri)) ,name)) 12 13 (define (hspan contents) 14 `(span (@ (class "hidden")) ,contents)) 15 16 (define (site-template site-metadata metadata body) 17 `(*TOP* (*DECL* DOCTYPE html) 18 (head 19 (meta (@ (charset "utf-8"))) 20 (meta (@ (name "viewport") 21 (content "width=device-width, initial-scale=1"))) 22 ;; TODO: Self-host fonts 23 (link (@ (rel "preconnect") 24 (href "https://fonts.googleapis.com"))) 25 (link (@ (rel "preconnect") 26 (href "https://fonts.gstatic.com") 27 (crossorigin))) 28 (link (@ (href "https://fonts.googleapis.com/css2?family=Vollkorn:ital,wght@0,400..900;1,400..900&display=swap") 29 (rel "stylesheet"))) 30 (link (@ (href "https://fonts.googleapis.com/css2?family=Vollkorn+SC:wght@400;600;700;900&display=swap") 31 (rel "stylesheet"))) 32 (title ,(string-append (assoc-ref metadata 'title) 33 " - " 34 (assoc-ref site-metadata 'title))) 35 (link (@ (rel "icon") 36 (href "/img/favicon.png"))) 37 ,(stylesheet "style")) 38 (body 39 (div (@ (id "cover")) 40 (img (@ (id "coverLogo") 41 (src "/img/logo.svg"))) 42 (a (@ (id "coverTitle") 43 (href "/")) 44 ,(assoc-ref site-metadata 'title)) 45 (div (@ (id "coverSubtitle")) 46 "Technology in the world, not of the world.") 47 (hr (@ (class "hidden"))) 48 (nav (@ (id "coverNav")) 49 ,(link "Home" "/") 50 ,(hspan " | ") 51 ,(link "Portfolio" "/portfolio.html") 52 ,(hspan " | ") 53 ,(link "Services" "/services.html") 54 ,(hspan " | ") 55 ,(link "Videos" "https://videos.monastech.xyz/") 56 ,(hspan " | ") 57 ,(link "About" "/about.html") 58 ,(hspan " | ") 59 ,(link "Contact" "/contact.html")) 60 (hr (@ (class "hidden")))) 61 62 (div (@ (id "content")) 63 (h1 (@ (id "title")) 64 ,(assoc-ref metadata 'title)) 65 ,@body 66 (hr) 67 (footer 68 (p "© 2025 Luke Willis")))))) 69 70 (define (blog-collection-template posts) 71 `((p "We specialize in the assembly of custom operating systems in order to \ 72 provide a more stable, secure, fast and " 73 (a (@ (href "https://www.gnu.org/philosophy/free-sw.html")) 74 "free") 75 " computing experience.") 76 (p "If you're frustrated with using Windows or MacOS but don't know what \ 77 your other options are, we can give you an alternative that perfectly fits \ 78 your practical needs and personal preferences.") 79 (p "Check out the " ,(link "FAQ" "/faq.html") " for more information.") 80 (h2 "Recent Articles") 81 ,@(map 82 (lambda (post) 83 `(p (@ (class "post")) 84 (span (@ (class "postLink")) 85 (a (@ (href ,(assoc-ref post 'uri))) 86 ,(assoc-ref post 'title))) 87 (br (@ (class "hidden"))) 88 ;; Parse ISO 8601 date from 'date and reformat it 89 (span (@ (class "postDate")) 90 ,(date->string 91 (string->date (assoc-ref post 'date) "~Y~m~d") 92 "~B ~d, ~Y")))) 93 (sort posts 94 (lambda (a b) 95 (string>? (assoc-ref a 'date) 96 (assoc-ref b 'date))))))) 97 98 (site #:metadata `((title . "MonasTech")) 99 #:builders (list (simple-pages 100 "pages" 101 #:template site-template) 102 (blog 103 "posts" 104 #:metadata `((title . "Welcome to MonasTech")) 105 #:template site-template 106 #:collection-template blog-collection-template) 107 (copy-directory "css") 108 (copy-directory "img")) 109 #:publishers (list (rsync-publisher #:user "lukejw" 110 #:host "monastech.xyz" 111 #:destination "/var/www/monastech.xyz/")))