monastech-pages

The files used to build https://monastech.xyz/
Log | Files | Refs

grug.scm (3900B)


      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      (title ,(string-append (assoc-ref metadata 'title)
     23                             " - "
     24                             (assoc-ref site-metadata 'title)))
     25      (link (@ (rel "icon")
     26               (href "/img/favicon.webp")))
     27      ,(stylesheet "style"))
     28      (body
     29       (div (@ (id "header"))
     30        (a (@ (id "headerLink")
     31              (href "/"))
     32           ,(assoc-ref site-metadata 'title))
     33        (span (@ (class "hidden")) " - ")
     34        (span (@ (id "headerSubtitle"))
     35              ,(or (assoc-ref metadata 'subtitle)
     36                   "Technology in the world, not of the world.")))
     37       (hr (@ (class "hidden")))
     38       (nav
     39        ,(link "Home" "/")
     40        ,(hspan " | ")
     41        ,(link "Services" "/services.html")
     42        ,(hspan " | ")
     43        ,(link "Examples" "/examples.html")
     44        ,(hspan " | ")
     45        ,(link "FAQ" "/faq.html")
     46        ,(hspan " | ")
     47        ,(link "Contact" "/contact.html"))
     48       (hr (@ (class "hidden")))
     49       (div (@ (id "content"))
     50            ,@body)
     51       (hr)
     52       (footer
     53        (p "© 2025 Luke Willis")))))
     54 
     55 (define (blog-collection-template posts)
     56   `((img (@ (id "frontPageArt")
     57             (src "/img/monastech-cat-full.webp")))
     58     (p "Welcome to MonasTech, where we help make technology in the world, \
     59 not of the world.")
     60     (p "We specialize in the assembly of custom operating systems in order to \
     61 provide a more stable, secure, fast and "
     62        (a (@ (href "https://www.gnu.org/philosophy/free-sw.html"))
     63           "free")
     64        " computing experience.")
     65     (p "If you're frustrated with using Windows or MacOS but don't know what \
     66 your other options are, we can give you an alternative that perfectly fits \
     67 your practical needs and personal preferences.")
     68     (p "Check out the " ,(link "FAQ" "/faq.html") " for more information.")
     69     (h2 "Recent Articles")
     70     ,@(map
     71         (lambda (post)
     72           `(p (@ (class "post"))
     73               (span (@ (class "postLink"))
     74                     (a (@ (href ,(assoc-ref post 'uri)))
     75                        ,(assoc-ref post 'title)))
     76               ,(hspan " - ")
     77               ;; Parse ISO 8601 date from 'date and reformat it
     78               (span (@ (class "postDate"))
     79                  ,(date->string
     80                    (string->date (assoc-ref post 'date) "~Y~m~d")
     81                    "~B ~d, ~Y"))))
     82         (sort posts
     83               (lambda (a b)
     84                 (string>? (assoc-ref a 'date)
     85                           (assoc-ref b 'date)))))))
     86 
     87 (site #:metadata `((title . "MonasTech"))
     88       #:builders (list (simple-pages
     89                         "pages"
     90                         #:template site-template)
     91                        (blog
     92                         "posts"
     93                         #:metadata `((title . "Home"))
     94                         #:template site-template
     95                         #:collection-template blog-collection-template)
     96                        (copy-directory "css")
     97                        (copy-directory "img"))
     98       #:publishers (list (rsync-publisher #:user "lukejw"
     99                                           #:host "monastech.xyz"
    100                                           #:destination "/var/www/htdocs/www.monastech.xyz/"
    101                                           #:flags (cons* "--rsync-path=openrsync"
    102                                                          %default-rsync-flags))))