pages

The files that build the MonasTech website
Log | Files | Refs

grug.scm (3806B)


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